]> khamidou — GitHub mirrors - electron.git/commitdiff
docs: Document app.getPath/app.setPath
authorCheng Zhao <zcbenz@gmail.com>
Mon, 19 Jan 2015 02:25:31 +0000 (18:25 -0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 19 Jan 2015 05:43:20 +0000 (21:43 -0800)
docs/api/app.md

index b7cb5f35aa0873a03451a53b5b63155ac69d2921..4620dcf8cf20a26f16ead552eb5a808ba1e12edd 100644 (file)
@@ -91,13 +91,33 @@ executed. It is possible that a window cancels the quitting by returning
 Quit the application directly, it will not try to close all windows so cleanup
 code will not run.
 
-## app.getDataPath()
+## app.getPath(name)
 
-Returns the path for storing configuration files, with app name appended.
+* `name` String
 
- * `%APPDATA%\MyAppName` on Windows
- * `~/.config/MyAppName` on Linux
- * `~/Library/Application Support/MyAppName` on OS X
+Retrieves a path to a special directory or file associated with `name`. On
+failure an `Error` would throw.
+
+You can request following paths by the names:
+
+* `home`: User's home directory
+* `appData`: Per-user application data directory, by default it is pointed to:
+  * `%APPDATA%` on Windows
+  * `~/.config` on Linux
+  * `~/Library/Application Support` on OS X
+* `userData`: The directory for storing your app's configuration files, by
+  default it is the `appData` directory appended with your app's name.
+
+## app.setPath(name, path)
+
+* `name` String
+* `path` String
+
+Overrides the `path` to a special directory or file associated with `name`. if
+the path specifies a directory that does not exist, the directory will be
+created by this method. On failure an `Error` would throw.
+
+You can only override paths of `name`s  defined in `app.getPath`.
 
 ## app.getVersion()