Commit 8495af3b authored by chenyu@chromium.org's avatar chenyu@chromium.org

Add an iOS implementation for base::PathService::Get() with path key DIR_APP_DATA.

This implementation creates a DIR_APP_DATA directory if it does not exist. This is needed for iOS because on iOS NSApplicationSupportDirectory directory does not exist unless it is created explicitly. 

BUG=NONE
TEST=NONE

Review URL: https://chromiumcodereview.appspot.com/10795010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149331 0039d316-1c4b-4281-b951-d872f2087c98
parent e13fab33
......@@ -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: {
bool success = base::mac::GetUserDirectory(NSApplicationSupportDirectory,
result);
#if defined(OS_IOS)
// On IOS, this directory does not exist unless it is created explicitly.
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))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment