Index: base/base_paths_mac.mm |
diff --git a/base/base_paths_mac.mm b/base/base_paths_mac.mm |
index 965d9d3696eca24e7c5ab98306bc4d8f727621a5..626cc97849685254266d3532ddc30e529633e3d1 100644 |
--- a/base/base_paths_mac.mm |
+++ b/base/base_paths_mac.mm |
@@ -15,6 +15,24 @@ |
namespace base { |
+namespace { |
+// TODO(akalin): Export this function somewhere and use it in |
Mark Mentovai
2009/09/16 18:33:41
Minor style nit. Leave a blank line after the nam
|
+// 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); |
Mark Mentovai
2009/09/16 18:33:41
Minor style nit. Continuation lines get indented
|
+ 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 +45,10 @@ bool PathProviderMac(int key, FilePath* result) { |
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); |