Index: chrome/common/chrome_paths_linux.cc |
diff --git a/chrome/common/chrome_paths_linux.cc b/chrome/common/chrome_paths_linux.cc |
index 42c6ae7e03e103cf1088f387a307fe202043a303..7f82fa112a21ca5f2f00d8db68dc8dffffbfda25 100644 |
--- a/chrome/common/chrome_paths_linux.cc |
+++ b/chrome/common/chrome_paths_linux.cc |
@@ -28,6 +28,31 @@ bool GetDefaultUserDataDirectory(FilePath* result) { |
return true; |
} |
+bool GetUserCacheDirectory(const FilePath& profile_dir, FilePath* result) { |
+ // See http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html |
+ // for a spec on where cache files go. Our rule is: |
+ // - if the user-data-dir in the standard place, |
+ // use same subdirectory of the cache directory. |
+ // (this maps ~/.config/google-chrome to ~/.cache/google-chrome as well |
+ // as the same thing for ~/.config/chromium) |
+ // - otherwise, use the user-data-dir directly. |
+ |
+ scoped_ptr<base::Environment> env(base::Environment::Create()); |
+ FilePath cache_dir( |
+ base::nix::GetXDGDirectory(env.get(), "XDG_CACHE_HOME", ".cache")); |
+ FilePath config_dir( |
+ base::nix::GetXDGDirectory(env.get(), "XDG_CONFIG_HOME", ".config")); |
+ |
+ FilePath system_relative_dir = cache_dir; |
Mark Mentovai
2010/11/18 16:55:57
By the way, “why the copy?” applies here too.
|
+ if (config_dir.AppendRelativePath(profile_dir, &system_relative_dir)) { |
+ *result = system_relative_dir; |
+ return true; |
+ } |
+ |
+ *result = profile_dir; |
+ return true; |
+} |
+ |
bool GetChromeFrameUserDataDirectory(FilePath* result) { |
scoped_ptr<base::Environment> env(base::Environment::Create()); |
FilePath config_dir( |