linux: Override DIR_APP_DATA before loading .js
This commit is contained in:
parent
76e3d56760
commit
c9463d815c
2 changed files with 26 additions and 29 deletions
|
@ -9,7 +9,6 @@
|
|||
#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,31 +19,10 @@
|
|||
#include "content/public/browser/resource_context.h"
|
||||
#include "content/public/browser/storage_partition.h"
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
#include "base/nix/xdg_util.h"
|
||||
#endif
|
||||
|
||||
using content::BrowserThread;
|
||||
|
||||
namespace brightray {
|
||||
|
||||
namespace {
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
void OverrideLinuxAppDataPath() {
|
||||
base::FilePath path;
|
||||
if (PathService::Get(DIR_APP_DATA, &path))
|
||||
return;
|
||||
scoped_ptr<base::Environment> env(base::Environment::Create());
|
||||
path = base::nix::GetXDGDirectory(env.get(),
|
||||
base::nix::kXdgConfigHomeEnvVar,
|
||||
base::nix::kDotConfigDir);
|
||||
PathService::Override(DIR_APP_DATA, path);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
|
||||
class BrowserContext::ResourceContext : public content::ResourceContext {
|
||||
public:
|
||||
ResourceContext() : getter_(nullptr) {}
|
||||
|
@ -69,10 +47,6 @@ BrowserContext::BrowserContext() : resource_context_(new ResourceContext) {
|
|||
}
|
||||
|
||||
void BrowserContext::Initialize() {
|
||||
#if defined(OS_LINUX)
|
||||
OverrideLinuxAppDataPath();
|
||||
#endif
|
||||
|
||||
if (!PathService::Get(DIR_USER_DATA, &path_)) {
|
||||
PathService::Get(DIR_APP_DATA, &path_);
|
||||
path_ = path_.Append(base::FilePath::FromUTF8Unsafe(GetApplicationName()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue