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

Unified Diff: base/base_paths_mac.mm

Issue 204043: Set OS X cache directory to ~/Library/Caches/[app name]/[profile name] ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 months 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 | « base/base_paths_mac.h ('k') | base/file_path.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/base_paths_mac.mm
===================================================================
--- base/base_paths_mac.mm (revision 26368)
+++ base/base_paths_mac.mm (working copy)
@@ -15,6 +15,26 @@
namespace base {
+namespace {
+
+// TODO(akalin): Export this function somewhere and use it in
+// chrome_paths_mac.mm and mac_util.mm. This is tricky because
+// NSSearchPathDirectory is declared in an Objective C header so we
+// cannot put it in one of the usual locations (where pure C++ files
+// would include them).
+bool GetUserDirectory(NSSearchPathDirectory directory, FilePath* result) {
+ NSArray* dirs =
+ NSSearchPathForDirectoriesInDomains(directory, NSUserDomainMask, YES);
+ if ([dirs count] < 1) {
+ return false;
+ }
+ NSString* path = [dirs objectAtIndex:0];
+ *result = FilePath([path fileSystemRepresentation]);
+ return true;
+}
+
+} // namespace
+
bool PathProviderMac(int key, FilePath* result) {
std::string cur;
switch (key) {
@@ -27,6 +47,10 @@
cur = [path fileSystemRepresentation];
break;
}
+ case base::DIR_CACHE:
+ return GetUserDirectory(NSCachesDirectory, result);
+ case base::DIR_APP_DATA:
+ return GetUserDirectory(NSApplicationSupportDirectory, result);
case base::DIR_SOURCE_ROOT: {
FilePath path;
PathService::Get(base::DIR_EXE, &path);
« no previous file with comments | « base/base_paths_mac.h ('k') | base/file_path.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698