Chromium Code Reviews| Index: chrome/browser/extensions/path_util.cc |
| diff --git a/chrome/browser/extensions/path_util.cc b/chrome/browser/extensions/path_util.cc |
| index 429f9e4438759217bb484e8b0e09260e73dc021f..bf3f36b9194f21405d756c16290368f64baab14f 100644 |
| --- a/chrome/browser/extensions/path_util.cc |
| +++ b/chrome/browser/extensions/path_util.cc |
| @@ -40,10 +40,17 @@ std::string GetDisplayBaseName(const base::FilePath& path) { |
| } |
| } // namespace |
| +#endif // defined(OS_MACOSX) |
| base::FilePath PrettifyPath(const base::FilePath& source_path) { |
| + if (source_path.empty()) |
| + return base::FilePath(); |
| + |
| base::FilePath home_path; |
| - PathService::Get(base::DIR_HOME, &home_path); |
| + if (!PathService::Get(base::DIR_HOME, &home_path)) |
| + return source_path; |
| + |
| +#if defined(OS_MACOSX) |
| DCHECK(source_path.IsAbsolute()); |
| // Break down the incoming path into components, and grab the display name |
| @@ -68,17 +75,13 @@ base::FilePath PrettifyPath(const base::FilePath& source_path) { |
| } |
| DCHECK_EQ(actual_path.value(), source_path.value()); |
| return display_path; |
| -} |
| -#else // defined(OS_MACOSX) |
| -base::FilePath PrettifyPath(const base::FilePath& source_path) { |
| - base::FilePath home_path; |
| +#else // defined(OS_MACOSX) |
| base::FilePath display_path = base::FilePath::FromUTF8Unsafe("~"); |
|
Devlin
2014/08/05 23:40:35
nit: prefer to make this a FILE_PATH_LITERAL, and
gpdavis
2014/08/06 18:37:26
You mean like this, right?
base::FilePath display
|
| - if (PathService::Get(base::DIR_HOME, &home_path) && |
| - home_path.AppendRelativePath(source_path, &display_path)) |
| + if (home_path.AppendRelativePath(source_path, &display_path)) |
| return display_path; |
| return source_path; |
| -} |
| #endif // defined(OS_MACOSX) |
| +} |
| } // namespace path_util |
| } // namespace extensions |