summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorthorogood@chromium.org <thorogood@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-23 08:22:44 +0000
committerthorogood@chromium.org <thorogood@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-23 08:22:44 +0000
commit92e44ae0ad94910984b79979ad47d6b32b534c57 (patch)
tree9144c20bd36d281f3885c1b29539142b8cce0a55 /base
parentaf312ef7fecc613eef9532fd64b48ca23110db09 (diff)
downloadchromium_src-92e44ae0ad94910984b79979ad47d6b32b534c57.zip
chromium_src-92e44ae0ad94910984b79979ad47d6b32b534c57.tar.gz
chromium_src-92e44ae0ad94910984b79979ad47d6b32b534c57.tar.bz2
Prettify output from chrome.fileSystem.getDisplayPath for POSIX profile directories
This duplicates review 10693089, except for POSIX. Modifies e.g. "/home/sam/foo" to "~/foo". As a dependency, adds DIR_HOME to PathService for retrieving POSIX home directory. BUG=135690 TEST= Review URL: https://chromiumcodereview.appspot.com/10700136 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147833 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/base_paths.h1
-rw-r--r--base/base_paths_mac.mm4
-rw-r--r--base/base_paths_posix.cc7
-rw-r--r--base/file_util_posix.cc2
4 files changed, 12 insertions, 2 deletions
diff --git a/base/base_paths.h b/base/base_paths.h
index ea62a8b..3875fb4 100644
--- a/base/base_paths.h
+++ b/base/base_paths.h
@@ -40,6 +40,7 @@ enum BasePathKey {
// browser cache can be a subdirectory.
// This is $XDG_CACHE_HOME on Linux and
// ~/Library/Caches on Mac.
+ DIR_HOME, // $HOME on POSIX-like systems.
#endif
PATH_END
diff --git a/base/base_paths_mac.mm b/base/base_paths_mac.mm
index 56f3ecb..e46fd1e 100644
--- a/base/base_paths_mac.mm
+++ b/base/base_paths_mac.mm
@@ -83,6 +83,10 @@ bool PathProviderMac(int key, FilePath* result) {
#endif
return true;
}
+ case base::DIR_HOME: {
+ *result = base::mac::NSStringToFilePath(NSHomeDirectory());
+ return true;
+ }
default:
return false;
}
diff --git a/base/base_paths_posix.cc b/base/base_paths_posix.cc
index d8d5ae6..743f77a 100644
--- a/base/base_paths_posix.cc
+++ b/base/base_paths_posix.cc
@@ -85,12 +85,17 @@ bool PathProviderPosix(int key, FilePath* result) {
<< "Try running from your chromium/src directory.";
return false;
}
- case base::DIR_CACHE:
+ case base::DIR_CACHE: {
scoped_ptr<base::Environment> env(base::Environment::Create());
FilePath cache_dir(base::nix::GetXDGDirectory(env.get(), "XDG_CACHE_HOME",
".cache"));
*result = cache_dir;
return true;
+ }
+ case base::DIR_HOME: {
+ *result = file_util::GetHomeDir();
+ return true;
+ }
}
return false;
}
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index f198f44..0dc4f33 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -1085,7 +1085,7 @@ bool CopyFile(const FilePath& from_path, const FilePath& to_path) {
return result;
}
-#endif // defined(OS_MACOSX)
+#endif // !defined(OS_MACOSX)
bool VerifyPathControlledByUser(const FilePath& base,
const FilePath& path,