Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Unified Diff: chrome/common/chrome_paths_mac.mm

Issue 5123004: chrome_paths: refactor and sanitize cache directory handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 80 Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/chrome_paths_linux.cc ('k') | chrome/common/chrome_paths_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/chrome_paths_mac.mm
diff --git a/chrome/common/chrome_paths_mac.mm b/chrome/common/chrome_paths_mac.mm
index b87b39788ecd09ae100c4a9eef4fedc03dfdf6bb..67a687d9b9e6e06339ec6df20ccc4cb7b3361eb9 100644
--- a/chrome/common/chrome_paths_mac.mm
+++ b/chrome/common/chrome_paths_mac.mm
@@ -48,6 +48,28 @@ bool GetUserDocumentsDirectory(FilePath* result) {
return mac_util::GetUserDirectory(NSDocumentDirectory, result);
}
+bool GetUserCacheDirectory(const FilePath& profile_dir, FilePath* result) {
+ // If the profile directory is under ~/Library/Application Support,
+ // use a suitable cache directory under ~/Library/Caches. For
+ // example, a profile directory of ~/Library/Application
+ // Support/Google/Chrome/MyProfileName would use the cache directory
+ // ~/Library/Caches/Google/Chrome/MyProfileName.
+
+ FilePath app_data_dir;
+ if (PathService::Get(base::DIR_APP_DATA, &app_data_dir)) {
+ FilePath cache_dir = cache_dir;
Mark Mentovai 2010/11/18 19:11:48 Definitely not.
Evan Martin 2010/11/18 19:19:06 Aw, c'mon, it's tautologically true! *embarrasse
+ if (!PathService::Get(base::DIR_CACHE, &cache_dir))
+ return false;
+ if (app_data_dir.AppendRelativePath(profile_dir, &cache_dir)) {
+ *result = cache_dir;
+ return true;
+ }
+ }
+
+ *result = profile_dir;
+ return true;
+}
+
bool GetUserDownloadsDirectory(FilePath* result) {
return mac_util::GetUserDirectory(NSDownloadsDirectory, result);
}
« no previous file with comments | « chrome/common/chrome_paths_linux.cc ('k') | chrome/common/chrome_paths_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698