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

Unified Diff: chrome/browser/extensions/api/file_system/file_system_api.cc

Issue 10700136: Prettify output from chrome.fileSystem.getDisplayPath for POSIX profile directories (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 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
Index: chrome/browser/extensions/api/file_system/file_system_api.cc
diff --git a/chrome/browser/extensions/api/file_system/file_system_api.cc b/chrome/browser/extensions/api/file_system/file_system_api.cc
index 871125e0030030d2aab9d8263ef184ef5e896dbb..49324e0c09f48d5f8c5f95128a7a95d450124ab5 100644
--- a/chrome/browser/extensions/api/file_system/file_system_api.cc
+++ b/chrome/browser/extensions/api/file_system/file_system_api.cc
@@ -48,19 +48,13 @@ struct RewritePair {
const RewritePair g_rewrite_pairs[] = {
#if defined(OS_WIN)
{base::DIR_PROFILE, "~"},
+#elif defined(OS_POSIX)
+ {base::DIR_HOME, "~"},
#endif
};
FilePath PrettifyPath(const FilePath& file_path) {
- // Note that when g_rewrite_pairs includes at least one value on all
- // platforms, this code can be cleaned up.
-#if defined(OS_WIN)
- size_t size = arraysize(g_rewrite_pairs);
-#else
- size_t size = 0;
-#endif
-
- for (size_t i = 0; i < size; ++i) {
+ for (size_t i = 0; i < arraysize(g_rewrite_pairs); ++i) {
benwells 2012/07/10 23:57:49 I don't like relying on the fact that OS_POSIX is
thorogood 2012/07/11 00:30:24 I've guarded the whole for loop by "#if defined(OS
benwells 2012/07/11 04:51:45 Yeah agreed, this is nicer.
FilePath candidate_path;
if (!PathService::Get(g_rewrite_pairs[i].path_key, &candidate_path))
continue; // We don't DCHECK this value, as Get will return false even

Powered by Google App Engine
This is Rietveld 408576698