]> khamidou — GitHub mirrors - electron.git/commitdiff
Add "cache" and "userCache" directories
authorCheng Zhao <zcbenz@gmail.com>
Mon, 19 Jan 2015 05:09:42 +0000 (21:09 -0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 19 Jan 2015 05:43:22 +0000 (21:43 -0800)
atom/browser/api/atom_api_app.cc
atom/browser/default_app/main.js
atom/browser/lib/init.coffee
docs/api/app.md
vendor/brightray

index 440795831ae44e19ce3eea69a64a97a860caa11e..ae2228ff941dc65a63f85c19e2e79f4dcde3b3bc 100644 (file)
@@ -67,6 +67,10 @@ int GetPathConstant(const std::string& name) {
     return brightray::DIR_APP_DATA;
   else if (name == "userData")
     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")
     return base::DIR_HOME;
   else
index c7ea581cefa692df5e127d73e76743da44482cd4..103c05cc11297565e08c3aea1320aefe12379656 100644 (file)
@@ -42,6 +42,7 @@ if (option.file && !option.webdriver) {
       else if (packageJson.name)
         app.setName(packageJson.name);
       app.setPath('userData', path.join(app.getPath('appData'), app.getName()));
+      app.setPath('userCache', path.join(app.getPath('cache'), app.getName()));
     }
 
     // Run the app.
index b0cee6badf475abb95a8a95695d631564f461e3c..d3234db757a08c0c6fdfc5714084010b92253c4a 100644 (file)
@@ -90,8 +90,9 @@ process.once 'BIND_DONE', ->
   else
     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 'userCache', path.join(app.getPath('cache'), app.getName())
 
   # Load the chrome extension support.
   require './chrome-extension.js'
index b32032924782bc617d9b14e49d4cbd936f40a9a9..9bc5c8b24ae6ef0e22a78bb7518115456e224f5f 100644 (file)
@@ -107,6 +107,12 @@ You can request following paths by the names:
   * `~/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.
+* `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)
 
index f19c269ab974f22f31782c0c395119130fb59b15..ad17292154ddd2436c377bbe2d10fa213338f4fa 160000 (submodule)
@@ -1 +1 @@
-Subproject commit f19c269ab974f22f31782c0c395119130fb59b15
+Subproject commit ad17292154ddd2436c377bbe2d10fa213338f4fa