Allow using current argv for relaunch

This commit is contained in:
Cheng Zhao 2016-06-02 20:47:47 +09:00
parent 9a08cbce27
commit 8435f1c900
3 changed files with 18 additions and 3 deletions

View file

@ -34,9 +34,21 @@ Browser* Browser::Get() {
return AtomBrowserMainParts::Get()->browser();
}
bool Browser::Relaunch(const base::FilePath& app,
bool Browser::Relaunch(bool override_argv,
const base::FilePath& app,
const relauncher::StringVector& args) {
if (!override_argv) {
#if defined(OS_WIN)
const relauncher::StringVector& argv = atom::AtomCommandLine::wargv();
#else
const relauncher::StringVector& argv = atom::AtomCommandLine::argv();
#endif
return relauncher::RelaunchApp(argv);
}
relauncher::StringVector argv;
argv.reserve(1 + args.size());
if (app.empty()) {
base::FilePath exe_path;
PathService::Get(base::FILE_EXE, &exe_path);
@ -45,6 +57,8 @@ bool Browser::Relaunch(const base::FilePath& app,
argv.push_back(app.value());
}
argv.insert(argv.end(), args.begin(), args.end());
return relauncher::RelaunchApp(argv);
}

View file

@ -55,7 +55,8 @@ class Browser : public WindowListObserver {
void Shutdown();
// Restart the app.
bool Relaunch(const base::FilePath& app,
bool Relaunch(bool override_argv,
const base::FilePath& app,
const relauncher::StringVector& args);
// Focus the application.

View file

@ -31,7 +31,7 @@ HANDLE GetParentProcessHandle(base::ProcessHandle handle) {
}
PROCESS_BASIC_INFORMATION pbi;
LONG status = NtQueryInformationProcess(
LONG status = NtQueryInformationProcess(
handle, ProcessBasicInformation,
&pbi, sizeof(PROCESS_BASIC_INFORMATION), NULL);
if (!NT_SUCCESS(status)) {