| 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);
|
|
|