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

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: add a comment 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..9ca04d2b83289f8fa3e670d029601c11020e54e9 100644
--- a/base/base_paths_mac.mm
+++ b/base/base_paths_mac.mm
@@ -59,8 +59,20 @@ 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:
+ case base::DIR_APP_DATA: {
+#if defined(OS_IOS)
rohitrao (ping after 24h) 2012/07/18 16:01:34 bool success = base::mac::GetUserDirectory(NSAppli
chenyu 2012/07/18 16:43:32 Done. I keep the if-def for now and will remove it
+ // On IOS, this directory does not exist unless it is created explicitly.
+ bool success = base::mac::GetUserDirectory(NSApplicationSupportDirectory,
+ result);
+ if (success && !file_util::PathExists(*result) &&
+ !file_util::CreateDirectory(*result)) {
+ return false;
+ }
+ return success;
+#else
return base::mac::GetUserDirectory(NSApplicationSupportDirectory, result);
+#endif // defined(OS_IOS)
+ }
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