diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-18 17:55:55 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-18 17:55:55 +0000 |
commit | fd928963e061cc7687c86a251bfb061749373212 (patch) | |
tree | e83db904dd05a21e56bc18e649bc48ef7b9ece71 /chrome/browser/shell_integration_linux.cc | |
parent | 5895c5bbf2aa5267e3707ece57880ebd564630e4 (diff) | |
download | chromium_src-fd928963e061cc7687c86a251bfb061749373212.zip chromium_src-fd928963e061cc7687c86a251bfb061749373212.tar.gz chromium_src-fd928963e061cc7687c86a251bfb061749373212.tar.bz2 |
More reliably find the .desktop file for the browser.
Also search in "applications" subdirectory of each of XDG_DATA_DIRS.
TEST=See bug.
BUG=21995
Review URL: http://codereview.chromium.org/214010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26590 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/shell_integration_linux.cc')
-rw-r--r-- | chrome/browser/shell_integration_linux.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc index 1c3fad2..78c8443 100644 --- a/chrome/browser/shell_integration_linux.cc +++ b/chrome/browser/shell_integration_linux.cc @@ -77,25 +77,27 @@ bool LaunchXdgUtility(const std::vector<std::string>& argv) { } bool GetDesktopShortcutTemplate(std::string* output) { - std::vector<std::string> search_paths; + std::vector<FilePath> search_paths; const char* xdg_data_home = getenv("XDG_DATA_HOME"); if (xdg_data_home) - search_paths.push_back(xdg_data_home); + search_paths.push_back(FilePath(xdg_data_home)); const char* xdg_data_dirs = getenv("XDG_DATA_DIRS"); if (xdg_data_dirs) { CStringTokenizer tokenizer(xdg_data_dirs, xdg_data_dirs + strlen(xdg_data_dirs), ":"); while (tokenizer.GetNext()) { - search_paths.push_back(tokenizer.token()); + FilePath data_dir(tokenizer.token()); + search_paths.push_back(data_dir); + search_paths.push_back(data_dir.Append("applications")); } } std::string template_filename(GetDesktopName()); - for (std::vector<std::string>::const_iterator i = search_paths.begin(); + for (std::vector<FilePath>::const_iterator i = search_paths.begin(); i != search_paths.end(); ++i) { - FilePath path = FilePath(*i).Append(template_filename); + FilePath path = (*i).Append(template_filename); if (file_util::PathExists(path)) return file_util::ReadFileToString(path, output); } |