PathService -> base::PathService
This commit is contained in:
parent
7092fa31a4
commit
de581ca0b4
17 changed files with 30 additions and 28 deletions
|
@ -49,7 +49,7 @@ void AtomMainDelegate::OverrideChildProcessPath() {
|
|||
GetHelperAppPath(frameworks_path, brightray::GetApplicationName());
|
||||
if (!base::PathExists(helper_path))
|
||||
LOG(FATAL) << "Unable to find helper app";
|
||||
PathService::Override(content::CHILD_PROCESS_EXE, helper_path);
|
||||
base::PathService::Override(content::CHILD_PROCESS_EXE, helper_path);
|
||||
}
|
||||
|
||||
void AtomMainDelegate::SetUpBundleOverrides() {
|
||||
|
|
|
@ -837,7 +837,7 @@ base::FilePath App::GetPath(mate::Arguments* args, const std::string& name) {
|
|||
base::FilePath path;
|
||||
int key = GetPathConstant(name);
|
||||
if (key >= 0)
|
||||
succeed = PathService::Get(key, &path);
|
||||
succeed = base::PathService::Get(key, &path);
|
||||
if (!succeed)
|
||||
args->ThrowError("Failed to get '" + name + "' path");
|
||||
return path;
|
||||
|
@ -854,7 +854,8 @@ void App::SetPath(mate::Arguments* args,
|
|||
bool succeed = false;
|
||||
int key = GetPathConstant(name);
|
||||
if (key >= 0)
|
||||
succeed = PathService::OverrideAndCreateIfNeeded(key, path, true, false);
|
||||
succeed =
|
||||
base::PathService::OverrideAndCreateIfNeeded(key, path, true, false);
|
||||
if (!succeed)
|
||||
args->ThrowError("Failed to set path");
|
||||
}
|
||||
|
@ -886,7 +887,7 @@ bool App::RequestSingleInstanceLock() {
|
|||
return true;
|
||||
|
||||
base::FilePath user_dir;
|
||||
PathService::Get(brightray::DIR_USER_DATA, &user_dir);
|
||||
base::PathService::Get(brightray::DIR_USER_DATA, &user_dir);
|
||||
|
||||
auto cb = base::Bind(&App::OnSecondInstance, base::Unretained(this));
|
||||
|
||||
|
@ -935,7 +936,7 @@ bool App::Relaunch(mate::Arguments* js_args) {
|
|||
|
||||
if (exec_path.empty()) {
|
||||
base::FilePath current_exe_path;
|
||||
PathService::Get(base::FILE_EXE, ¤t_exe_path);
|
||||
base::PathService::Get(base::FILE_EXE, ¤t_exe_path);
|
||||
argv.push_back(current_exe_path.value());
|
||||
} else {
|
||||
argv.push_back(exec_path.value());
|
||||
|
|
|
@ -312,7 +312,7 @@ void AtomBrowserClient::AppendExtraCommandLineSwitches(
|
|||
// Make sure we're about to launch a known executable
|
||||
{
|
||||
base::FilePath child_path;
|
||||
PathService::Get(content::CHILD_PROCESS_EXE, &child_path);
|
||||
base::PathService::Get(content::CHILD_PROCESS_EXE, &child_path);
|
||||
|
||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||
CHECK(base::MakeAbsoluteFilePath(command_line->GetProgram()) == child_path);
|
||||
|
|
|
@ -108,7 +108,7 @@ void AtomBrowserContext::RegisterPrefs(PrefRegistrySimple* pref_registry) {
|
|||
pref_registry->RegisterFilePathPref(prefs::kSelectFileLastDirectory,
|
||||
base::FilePath());
|
||||
base::FilePath download_dir;
|
||||
PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &download_dir);
|
||||
base::PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &download_dir);
|
||||
pref_registry->RegisterFilePathPref(prefs::kDownloadDefaultDirectory,
|
||||
download_dir);
|
||||
pref_registry->RegisterDictionaryPref(prefs::kDevToolsFileSystemPaths);
|
||||
|
|
|
@ -152,7 +152,7 @@ void Browser::DidFinishLaunching(const base::DictionaryValue& launch_info) {
|
|||
// Make sure the userData directory is created.
|
||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||
base::FilePath user_data;
|
||||
if (PathService::Get(brightray::DIR_USER_DATA, &user_data))
|
||||
if (base::PathService::Get(brightray::DIR_USER_DATA, &user_data))
|
||||
base::CreateDirectoryAndGetError(user_data, nullptr);
|
||||
|
||||
is_ready_ = true;
|
||||
|
|
|
@ -45,7 +45,7 @@ BOOL CALLBACK WindowsEnumerationHandler(HWND hwnd, LPARAM param) {
|
|||
|
||||
bool GetProcessExecPath(base::string16* exe) {
|
||||
base::FilePath path;
|
||||
if (!PathService::Get(base::FILE_EXE, &path)) {
|
||||
if (!base::PathService::Get(base::FILE_EXE, &path)) {
|
||||
LOG(ERROR) << "Error getting app exe path";
|
||||
return false;
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ PCWSTR Browser::GetAppUserModelID() {
|
|||
|
||||
std::string Browser::GetExecutableFileVersion() const {
|
||||
base::FilePath path;
|
||||
if (PathService::Get(base::FILE_EXE, &path)) {
|
||||
if (base::PathService::Get(base::FILE_EXE, &path)) {
|
||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||
std::unique_ptr<FileVersionInfo> version_info(
|
||||
FileVersionInfo::CreateFileVersionInfo(path));
|
||||
|
|
|
@ -42,7 +42,7 @@ bool RelaunchApp(const StringVector& argv) {
|
|||
// helper process, because there's no guarantee that the updated version's
|
||||
// relauncher implementation will be compatible with the running version's.
|
||||
base::FilePath child_path;
|
||||
if (!PathService::Get(content::CHILD_PROCESS_EXE, &child_path)) {
|
||||
if (!base::PathService::Get(content::CHILD_PROCESS_EXE, &child_path)) {
|
||||
LOG(ERROR) << "No CHILD_PROCESS_EXE";
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ std::unique_ptr<const char* []> StringVectorToArgArray(
|
|||
base::FilePath GetResourcesPath(bool is_browser) {
|
||||
auto* command_line = base::CommandLine::ForCurrentProcess();
|
||||
base::FilePath exec_path(command_line->GetProgram());
|
||||
PathService::Get(base::FILE_EXE, &exec_path);
|
||||
base::PathService::Get(base::FILE_EXE, &exec_path);
|
||||
|
||||
base::FilePath resources_path =
|
||||
#if defined(OS_MACOSX)
|
||||
|
@ -285,7 +285,7 @@ node::Environment* NodeBindings::CreateEnvironment(
|
|||
process.Set("_noBrowserGlobals", resources_path);
|
||||
// The path to helper app.
|
||||
base::FilePath helper_exec_path;
|
||||
PathService::Get(content::CHILD_PROCESS_EXE, &helper_exec_path);
|
||||
base::PathService::Get(content::CHILD_PROCESS_EXE, &helper_exec_path);
|
||||
process.Set("helperExecPath", helper_exec_path);
|
||||
|
||||
return env;
|
||||
|
|
|
@ -83,7 +83,7 @@ v8::Local<v8::Value> GetBinding(v8::Isolate* isolate,
|
|||
|
||||
base::FilePath::StringType GetExecPath() {
|
||||
base::FilePath path;
|
||||
PathService::Get(base::FILE_EXE, &path);
|
||||
base::PathService::Get(base::FILE_EXE, &path);
|
||||
return path.value();
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ NetLog* BrowserClient::GetNetLog() {
|
|||
base::FilePath BrowserClient::GetDefaultDownloadDirectory() {
|
||||
// ~/Downloads
|
||||
base::FilePath path;
|
||||
if (PathService::Get(base::DIR_HOME, &path))
|
||||
if (base::PathService::Get(base::DIR_HOME, &path))
|
||||
path = path.Append(FILE_PATH_LITERAL("Downloads"));
|
||||
|
||||
return path;
|
||||
|
|
|
@ -57,10 +57,10 @@ scoped_refptr<BrowserContext> BrowserContext::Get(const std::string& partition,
|
|||
|
||||
BrowserContext::BrowserContext(const std::string& partition, bool in_memory)
|
||||
: in_memory_(in_memory), weak_factory_(this) {
|
||||
if (!PathService::Get(DIR_USER_DATA, &path_)) {
|
||||
PathService::Get(DIR_APP_DATA, &path_);
|
||||
if (!base::PathService::Get(DIR_USER_DATA, &path_)) {
|
||||
base::PathService::Get(DIR_APP_DATA, &path_);
|
||||
path_ = path_.Append(base::FilePath::FromUTF8Unsafe(GetApplicationName()));
|
||||
PathService::Override(DIR_USER_DATA, path_);
|
||||
base::PathService::Override(DIR_USER_DATA, path_);
|
||||
}
|
||||
|
||||
if (!in_memory_ && !partition.empty())
|
||||
|
|
|
@ -95,12 +95,12 @@ const int kWaitForUIThreadSeconds = 10;
|
|||
|
||||
void OverrideLinuxAppDataPath() {
|
||||
base::FilePath path;
|
||||
if (PathService::Get(DIR_APP_DATA, &path))
|
||||
if (base::PathService::Get(DIR_APP_DATA, &path))
|
||||
return;
|
||||
std::unique_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);
|
||||
base::PathService::Override(DIR_APP_DATA, path);
|
||||
}
|
||||
|
||||
int BrowserX11ErrorHandler(Display* d, XErrorEvent* error) {
|
||||
|
@ -173,10 +173,10 @@ BrowserMainParts::~BrowserMainParts() {}
|
|||
#if defined(OS_WIN) || defined(OS_LINUX)
|
||||
void OverrideAppLogsPath() {
|
||||
base::FilePath path;
|
||||
if (PathService::Get(brightray::DIR_APP_DATA, &path)) {
|
||||
if (base::PathService::Get(brightray::DIR_APP_DATA, &path)) {
|
||||
path = path.Append(base::FilePath::FromUTF8Unsafe(GetApplicationName()));
|
||||
path = path.Append(base::FilePath::FromUTF8Unsafe("logs"));
|
||||
PathService::Override(DIR_APP_LOGS, path);
|
||||
base::PathService::Override(DIR_APP_LOGS, path);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -15,7 +15,8 @@ void BrowserMainParts::OverrideAppLogsPath() {
|
|||
NSString* libraryPath =
|
||||
[NSHomeDirectory() stringByAppendingPathComponent:logsPath];
|
||||
|
||||
PathService::Override(DIR_APP_LOGS, base::FilePath([libraryPath UTF8String]));
|
||||
base::PathService::Override(DIR_APP_LOGS,
|
||||
base::FilePath([libraryPath UTF8String]));
|
||||
}
|
||||
|
||||
// Replicates NSApplicationMain, but doesn't start a run loop.
|
||||
|
|
|
@ -26,7 +26,7 @@ bool HasMainProcessKey() {
|
|||
base::FilePath MainApplicationBundlePath() {
|
||||
// Start out with the path to the running executable.
|
||||
base::FilePath path;
|
||||
PathService::Get(base::FILE_EXE, &path);
|
||||
base::PathService::Get(base::FILE_EXE, &path);
|
||||
|
||||
// Up to Contents.
|
||||
if (!HasMainProcessKey() &&
|
||||
|
|
|
@ -52,7 +52,7 @@ void LoadResourceBundle(const std::string& locale) {
|
|||
pak_dir =
|
||||
base::mac::FrameworkBundlePath().Append(FILE_PATH_LITERAL("Resources"));
|
||||
#else
|
||||
PathService::Get(base::DIR_MODULE, &pak_dir);
|
||||
base::PathService::Get(base::DIR_MODULE, &pak_dir);
|
||||
#endif
|
||||
|
||||
ui::ResourceBundle::InitSharedInstanceWithLocale(
|
||||
|
|
|
@ -41,7 +41,7 @@ void MainDelegate::OverrideChildProcessPath() {
|
|||
.Append("MacOS")
|
||||
.Append(GetApplicationName() + " Helper");
|
||||
|
||||
PathService::Override(content::CHILD_PROCESS_EXE, helper_path);
|
||||
base::PathService::Override(content::CHILD_PROCESS_EXE, helper_path);
|
||||
}
|
||||
|
||||
} // namespace brightray
|
||||
|
|
|
@ -323,7 +323,7 @@ bool IsChromeProcess(pid_t pid) {
|
|||
|
||||
auto* command_line = base::CommandLine::ForCurrentProcess();
|
||||
base::FilePath exec_path(command_line->GetProgram());
|
||||
PathService::Get(base::FILE_EXE, &exec_path);
|
||||
base::PathService::Get(base::FILE_EXE, &exec_path);
|
||||
|
||||
return (!other_chrome_path.empty() &&
|
||||
other_chrome_path.BaseName() == exec_path.BaseName());
|
||||
|
@ -820,7 +820,7 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout(
|
|||
to_send.push_back(kTokenDelimiter);
|
||||
|
||||
base::FilePath current_dir;
|
||||
if (!PathService::Get(base::DIR_CURRENT, ¤t_dir))
|
||||
if (!base::PathService::Get(base::DIR_CURRENT, ¤t_dir))
|
||||
return PROCESS_NONE;
|
||||
to_send.append(current_dir.value());
|
||||
|
||||
|
|
Loading…
Reference in a new issue