From 76e3d567605bd62edf8243ddbb4a24ac1d15c08d Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sun, 18 Jan 2015 17:19:25 -0800 Subject: [PATCH] Make DIR_APP_DATA available on Linux --- brightray/browser/brightray_paths.h | 14 ++++++++++++++ brightray/browser/browser_context.cc | 6 +++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/brightray/browser/brightray_paths.h b/brightray/browser/brightray_paths.h index f856337e9f90..83a3a9f1cdb3 100644 --- a/brightray/browser/brightray_paths.h +++ b/brightray/browser/brightray_paths.h @@ -5,6 +5,14 @@ #ifndef BROWSER_BRIGHTRAY_PATHS_H_ #define BROWSER_BRIGHTRAY_PATHS_H_ +#include "base/compiler_specific.h" + +#if defined(OS_WIN) +#include "base/base_paths_win.h" +#elif defined(OS_MACOSX) +#include "base/base_paths_mac.h" +#endif + namespace brightray { enum { @@ -12,6 +20,12 @@ enum { DIR_USER_DATA = PATH_START, // Directory where user data can be written. +#if defined(OS_LINUX) + DIR_APP_DATA, // Application Data directory under the user profile. +#else + DIR_APP_DATA = base::DIR_APP_DATA, +#endif + PATH_END }; diff --git a/brightray/browser/browser_context.cc b/brightray/browser/browser_context.cc index ed4d9f5d185e..d07c591ca789 100644 --- a/brightray/browser/browser_context.cc +++ b/brightray/browser/browser_context.cc @@ -33,13 +33,13 @@ namespace { #if defined(OS_LINUX) void OverrideLinuxAppDataPath() { base::FilePath path; - if (PathService::Get(base::DIR_APP_DATA, &path)) + if (PathService::Get(DIR_APP_DATA, &path)) return; scoped_ptr env(base::Environment::Create()); path = base::nix::GetXDGDirectory(env.get(), base::nix::kXdgConfigHomeEnvVar, base::nix::kDotConfigDir); - PathService::Override(base::DIR_APP_DATA, path); + PathService::Override(DIR_APP_DATA, path); } #endif @@ -74,7 +74,7 @@ void BrowserContext::Initialize() { #endif if (!PathService::Get(DIR_USER_DATA, &path_)) { - PathService::Get(base::DIR_APP_DATA, &path_); + PathService::Get(DIR_APP_DATA, &path_); path_ = path_.Append(base::FilePath::FromUTF8Unsafe(GetApplicationName())); PathService::Override(DIR_USER_DATA, path_); }