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

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: guard code with OS_WIN || OS_POSIX, plus FilePath fix 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..18d1dc21223b1105cec52cc92bce9767f1bb6981 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,14 @@ 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) {
+#if defined(OS_WIN) || defined(OS_POSIX)
+ for (size_t i = 0; i < arraysize(g_rewrite_pairs); ++i) {
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
@@ -74,6 +69,7 @@ FilePath PrettifyPath(const FilePath& file_path) {
return output;
}
}
+#endif
return file_path;
}

Powered by Google App Engine
This is Rietveld 408576698