diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-27 01:27:19 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-27 01:27:19 +0000 |
commit | 2438b1729d34840ed380ce1ef4f37f3f56faa5e7 (patch) | |
tree | 9f631c1af54409bc0fa13eb6e1743f0a0c3c9fe5 /base/base_paths_mac.mm | |
parent | c80f9b0e650db3addaa0217be50da5bebd323cc3 (diff) | |
download | chromium_src-2438b1729d34840ed380ce1ef4f37f3f56faa5e7.zip chromium_src-2438b1729d34840ed380ce1ef4f37f3f56faa5e7.tar.gz chromium_src-2438b1729d34840ed380ce1ef4f37f3f56faa5e7.tar.bz2 |
Moved GetUserDirectory() into mac_util.mm.
Made mac_util.mm and chrome_paths_mac.mm use GetUserDirectory().
Made firefox_importer_utils_mac.mm use PathService.
Added unittests for GetUserDirectory().
BUG=22045
TEST=trybots
Review URL: http://codereview.chromium.org/548123
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37206 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/base_paths_mac.mm')
-rw-r--r-- | base/base_paths_mac.mm | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/base/base_paths_mac.mm b/base/base_paths_mac.mm index ee0de67..df9f362 100644 --- a/base/base_paths_mac.mm +++ b/base/base_paths_mac.mm @@ -16,26 +16,6 @@ namespace base { -namespace { - -// TODO(akalin): Export this function somewhere and use it in -// 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); - 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) { @@ -53,9 +33,9 @@ bool PathProviderMac(int key, FilePath* result) { break; } case base::DIR_USER_CACHE: - return GetUserDirectory(NSCachesDirectory, result); + return mac_util::GetUserDirectory(NSCachesDirectory, result); case base::DIR_APP_DATA: - return GetUserDirectory(NSApplicationSupportDirectory, result); + return mac_util::GetUserDirectory(NSApplicationSupportDirectory, result); case base::DIR_SOURCE_ROOT: { PathService::Get(base::DIR_EXE, result); if (mac_util::AmIBundled()) { |