diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-19 20:34:23 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-19 20:34:23 +0000 |
commit | ffaee18e8a876257e5a9fed3eca6afcd60f481e1 (patch) | |
tree | eccb9ce482e600047b9e78aaf56ca048d2e9940e /base/base_paths.cc | |
parent | c48ad0b05fa7c639f76c16909f8b0b32e24c559f (diff) | |
download | chromium_src-ffaee18e8a876257e5a9fed3eca6afcd60f481e1.zip chromium_src-ffaee18e8a876257e5a9fed3eca6afcd60f481e1.tar.gz chromium_src-ffaee18e8a876257e5a9fed3eca6afcd60f481e1.tar.bz2 |
Add support for GetHomeDir for Mac and Windows.
Unifies the Path Service's base::DIR_HOME on Posix and base::DIR_PROFILE on Windows to just be base::DIR_HOME everywhere, and DIR_HOME will now work on Mac.
This removes the AssertIOAllowed check in the Posix implementation because that was only executed in a fallback case that no developer is likely to ever hit. In addition, the we do call this type of function on the UI thread, so either we need to promote the assertion to be at the top of the function or delete it. It seemed unreasonable to disallow using this one key of the path service on the UI thread (the other ones are OK) so I just went for deleting the assertion.
R=benwells@chromium.org
Review URL: https://codereview.chromium.org/159833003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252066 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/base_paths.cc')
-rw-r--r-- | base/base_paths.cc | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/base/base_paths.cc b/base/base_paths.cc index b4fc28b..1b99e85 100644 --- a/base/base_paths.cc +++ b/base/base_paths.cc @@ -13,35 +13,34 @@ namespace base { bool PathProvider(int key, FilePath* result) { // NOTE: DIR_CURRENT is a special case in PathService::Get - FilePath cur; switch (key) { case DIR_EXE: - PathService::Get(FILE_EXE, &cur); - cur = cur.DirName(); - break; + PathService::Get(FILE_EXE, result); + *result = result->DirName(); + return true; case DIR_MODULE: - PathService::Get(FILE_MODULE, &cur); - cur = cur.DirName(); - break; + PathService::Get(FILE_MODULE, result); + *result = result->DirName(); + return true; case DIR_TEMP: - if (!base::GetTempDir(&cur)) + if (!GetTempDir(result)) return false; - break; + return true; + case base::DIR_HOME: + *result = GetHomeDir(); + return true; case DIR_TEST_DATA: - if (!PathService::Get(DIR_SOURCE_ROOT, &cur)) + if (!PathService::Get(DIR_SOURCE_ROOT, result)) return false; - cur = cur.Append(FILE_PATH_LITERAL("base")); - cur = cur.Append(FILE_PATH_LITERAL("test")); - cur = cur.Append(FILE_PATH_LITERAL("data")); - if (!base::PathExists(cur)) // We don't want to create this. + *result = result->Append(FILE_PATH_LITERAL("base")); + *result = result->Append(FILE_PATH_LITERAL("test")); + *result = result->Append(FILE_PATH_LITERAL("data")); + if (!PathExists(*result)) // We don't want to create this. return false; - break; + return true; default: return false; } - - *result = cur; - return true; } } // namespace base |