Add "cache" and "userCache" directories
This commit is contained in:
parent
9a04f67c0a
commit
ce52a87477
5 changed files with 14 additions and 2 deletions
|
@ -67,6 +67,10 @@ int GetPathConstant(const std::string& name) {
|
||||||
return brightray::DIR_APP_DATA;
|
return brightray::DIR_APP_DATA;
|
||||||
else if (name == "userData")
|
else if (name == "userData")
|
||||||
return brightray::DIR_USER_DATA;
|
return brightray::DIR_USER_DATA;
|
||||||
|
else if (name == "cache")
|
||||||
|
return brightray::DIR_CACHE;
|
||||||
|
else if (name == "userCache")
|
||||||
|
return brightray::DIR_USER_CACHE;
|
||||||
else if (name == "home")
|
else if (name == "home")
|
||||||
return base::DIR_HOME;
|
return base::DIR_HOME;
|
||||||
else
|
else
|
||||||
|
|
|
@ -42,6 +42,7 @@ if (option.file && !option.webdriver) {
|
||||||
else if (packageJson.name)
|
else if (packageJson.name)
|
||||||
app.setName(packageJson.name);
|
app.setName(packageJson.name);
|
||||||
app.setPath('userData', path.join(app.getPath('appData'), app.getName()));
|
app.setPath('userData', path.join(app.getPath('appData'), app.getName()));
|
||||||
|
app.setPath('userCache', path.join(app.getPath('cache'), app.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run the app.
|
// Run the app.
|
||||||
|
|
|
@ -90,8 +90,9 @@ process.once 'BIND_DONE', ->
|
||||||
else
|
else
|
||||||
app.setDesktopName '#{app.getName()}.desktop'
|
app.setDesktopName '#{app.getName()}.desktop'
|
||||||
|
|
||||||
# Set the user data path according to application's name.
|
# Set the user path according to application's name.
|
||||||
app.setPath 'userData', path.join(app.getPath('appData'), app.getName())
|
app.setPath 'userData', path.join(app.getPath('appData'), app.getName())
|
||||||
|
app.setPath 'userCache', path.join(app.getPath('cache'), app.getName())
|
||||||
|
|
||||||
# Load the chrome extension support.
|
# Load the chrome extension support.
|
||||||
require './chrome-extension.js'
|
require './chrome-extension.js'
|
||||||
|
|
|
@ -107,6 +107,12 @@ You can request following paths by the names:
|
||||||
* `~/Library/Application Support` on OS X
|
* `~/Library/Application Support` on OS X
|
||||||
* `userData`: The directory for storing your app's configuration files, by
|
* `userData`: The directory for storing your app's configuration files, by
|
||||||
default it is the `appData` directory appended with your app's name.
|
default it is the `appData` directory appended with your app's name.
|
||||||
|
* `cache`: Per-user application cache directory, by default it is pointed to:
|
||||||
|
* `%APPDATA%` on Window, which doesn't has a universal place for cache
|
||||||
|
* `$XDG_CACHE_HOME` on Linux
|
||||||
|
* `~/Library/Caches` on OS X
|
||||||
|
* `userCache`: The directory for placing your app's caches, by default it is the
|
||||||
|
`cache` directory appended with your app's name.
|
||||||
|
|
||||||
## app.setPath(name, path)
|
## app.setPath(name, path)
|
||||||
|
|
||||||
|
|
2
vendor/brightray
vendored
2
vendor/brightray
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit f19c269ab974f22f31782c0c395119130fb59b15
|
Subproject commit ad17292154ddd2436c377bbe2d10fa213338f4fa
|
Loading…
Reference in a new issue