From 9638e3956f7e48596f5e9acdd15189e3647aa11c Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Wed, 14 Aug 2013 08:08:59 -0400 Subject: [PATCH] Don't use base::DIR_APP_DATA on Linux It doesn't exist. Instead, match content_shell by putting application-specific data in $XDG_CONFIG_HOME or ~/.config. --- brightray/browser/browser_context.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/brightray/browser/browser_context.cc b/brightray/browser/browser_context.cc index 494f08f64035..31c00b8d6aa0 100644 --- a/brightray/browser/browser_context.cc +++ b/brightray/browser/browser_context.cc @@ -9,6 +9,7 @@ #include "browser/network_delegate.h" #include "common/application_info.h" +#include "base/environment.h" #include "base/files/file_path.h" #include "base/path_service.h" #include "base/prefs/json_pref_store.h" @@ -20,6 +21,10 @@ #include "content/public/browser/storage_partition.h" #include "url_request_context_getter.h" +#if defined(OS_LINUX) +#include "base/nix/xdg_util.h" +#endif + namespace brightray { class BrowserContext::ResourceContext : public content::ResourceContext { @@ -83,7 +88,15 @@ base::FilePath BrowserContext::GetPath() { return path_; base::FilePath path; +#if defined(OS_LINUX) + scoped_ptr env(base::Environment::Create()); + path = base::nix::GetXDGDirectory(env.get(), + base::nix::kXdgConfigHomeEnvVar, + base::nix::kDotConfigDir); +#else CHECK(PathService::Get(base::DIR_APP_DATA, &path)); +#endif + path_ = path.Append(base::FilePath::FromUTF8Unsafe(GetApplicationName())); return path_; }