Chromium Code Reviews| Index: chrome/browser/shell_integration_linux.cc |
| diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc |
| index e7412aeff0f09a63a6101a00455ca726283a20c8..a2c9c86259626d0a2aa95ea8ae8b9dd7038a7697 100644 |
| --- a/chrome/browser/shell_integration_linux.cc |
| +++ b/chrome/browser/shell_integration_linux.cc |
| @@ -463,10 +463,15 @@ bool GetDesktopShortcutTemplate(base::Environment* env, |
| std::vector<base::FilePath> search_paths; |
| + // Search paths as specified in the XDG Base Directory Specification. |
|
benwells
2013/03/04 03:58:26
Could you put a link to the spec?
Matt Giuca
2013/03/04 04:18:26
Done.
|
| std::string xdg_data_home; |
| + std::string home; |
| if (env->GetVar("XDG_DATA_HOME", &xdg_data_home) && |
| !xdg_data_home.empty()) { |
| search_paths.push_back(base::FilePath(xdg_data_home)); |
| + } else if (env->GetVar("HOME", &home) && !home.empty()) { |
| + search_paths.push_back(base::FilePath(home).Append(".local").Append( |
| + "share")); |
| } |
| std::string xdg_data_dirs; |
| @@ -476,19 +481,16 @@ bool GetDesktopShortcutTemplate(base::Environment* env, |
| while (tokenizer.GetNext()) { |
| base::FilePath data_dir(tokenizer.token()); |
| search_paths.push_back(data_dir); |
| - search_paths.push_back(data_dir.Append("applications")); |
| } |
| + } else { |
| + search_paths.push_back(base::FilePath("/usr/share")); |
| + search_paths.push_back(base::FilePath("/usr/local/share")); |
| } |
| - // Add some fallback paths for systems which don't have XDG_DATA_DIRS or have |
| - // it incomplete. |
| - search_paths.push_back(base::FilePath("/usr/share/applications")); |
| - search_paths.push_back(base::FilePath("/usr/local/share/applications")); |
| - |
| std::string template_filename(GetDesktopName(env)); |
| for (std::vector<base::FilePath>::const_iterator i = search_paths.begin(); |
| i != search_paths.end(); ++i) { |
| - base::FilePath path = i->Append(template_filename); |
| + base::FilePath path = i->Append("applications").Append(template_filename); |
| VLOG(1) << "Looking for desktop file template in " << path.value(); |
| if (file_util::PathExists(path)) { |
| VLOG(1) << "Found desktop file template at " << path.value(); |