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..d8f7d7bbe0aa9857d75eee0ee70184c72ca95ca2 100644 |
--- a/chrome/browser/shell_integration_linux.cc |
+++ b/chrome/browser/shell_integration_linux.cc |
@@ -463,10 +463,16 @@ bool GetDesktopShortcutTemplate(base::Environment* env, |
std::vector<base::FilePath> search_paths; |
+ // Search paths as specified in the XDG Base Directory Specification. |
+ // http://standards.freedesktop.org/basedir-spec/latest/ |
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 +482,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/local/share")); |
+ search_paths.push_back(base::FilePath("/usr/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(); |