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

Unified Diff: base/base_paths_mac.mm

Issue 10795010: Add an iOS implementation for base::PathService::Get() with path key DIR_APP_DATA. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address review comments Created 8 years, 5 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 | « no previous file | no next file » | no next file with comments »
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 56f3ecb9a91e9be5c8888e2f9e53fc04a4cbf64a..6f7f990330578fc1203fee742b92f0b93ddfec24 100644
--- a/base/base_paths_mac.mm
+++ b/base/base_paths_mac.mm
@@ -59,8 +59,16 @@ bool PathProviderMac(int key, FilePath* result) {
reinterpret_cast<const void*>(&base::PathProviderMac));
case base::DIR_CACHE:
return base::mac::GetUserDirectory(NSCachesDirectory, result);
- case base::DIR_APP_DATA:
- return base::mac::GetUserDirectory(NSApplicationSupportDirectory, result);
+ case base::DIR_APP_DATA: {
+ // On IOS, this directory does not exist unless it is created explicitly.
rohitrao (ping after 24h) 2012/07/25 14:45:51 This comment should move down inside the OS_IOS bl
+ bool success = base::mac::GetUserDirectory(NSApplicationSupportDirectory,
+ result);
+#if defined(OS_IOS)
+ if (success && !file_util::PathExists(*result))
+ success = file_util::CreateDirectory(*result);
+#endif // defined(OS_IOS)
+ return success;
+ }
case base::DIR_SOURCE_ROOT: {
// Go through PathService to catch overrides.
if (!PathService::Get(base::FILE_EXE, result))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698