summaryrefslogtreecommitdiffstats
path: root/chrome/browser/shell_integration_linux.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/shell_integration_linux.cc')
-rw-r--r--chrome/browser/shell_integration_linux.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc
index e7412ae..d8f7d7b 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();