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

Unified Diff: base/base_paths_mac.mm

Issue 174053: Set OS X cache directory to ~/Library/Caches/[app name]/[profile name] (Closed)
Patch Set: Addressed Mark's comments 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') | base/file_path.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « base/base_paths_mac.h ('k') | base/file_path.h » ('j') | base/file_path.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698