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..11494f822defab1e0dfa356f44e167449fd75e52 100644 |
--- a/chrome/common/chrome_paths_mac.mm |
+++ b/chrome/common/chrome_paths_mac.mm |
@@ -48,6 +48,30 @@ 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 cache_dir; |
+ if (!mac_util::GetUserDirectory(NSCachesDirectory, &cache_dir)) |
+ return false; |
+ |
+ FilePath app_data_dir; |
+ if (PathService::Get(base::DIR_APP_DATA, &app_data_dir)) { |
+ FilePath system_relative_dir = cache_dir; |
Mark Mentovai
2010/11/18 16:54:54
Do you need this copy? Why don’t you just move the
Evan Martin
2010/11/18 18:13:07
I found the usage of AppendRelativePath kind of ha
|
+ if (app_data_dir.AppendRelativePath(profile_dir, &system_relative_dir)) { |
+ *result = system_relative_dir; |
+ return true; |
+ } |
+ } |
+ |
+ *result = profile_dir; |
+ return true; |
+} |
+ |
bool GetUserDownloadsDirectory(FilePath* result) { |
return mac_util::GetUserDirectory(NSDownloadsDirectory, result); |
} |