Allow using current argv for relaunch
This commit is contained in:
parent
9a08cbce27
commit
8435f1c900
3 changed files with 18 additions and 3 deletions
|
@ -34,9 +34,21 @@ Browser* Browser::Get() {
|
||||||
return AtomBrowserMainParts::Get()->browser();
|
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) {
|
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;
|
relauncher::StringVector argv;
|
||||||
|
argv.reserve(1 + args.size());
|
||||||
|
|
||||||
if (app.empty()) {
|
if (app.empty()) {
|
||||||
base::FilePath exe_path;
|
base::FilePath exe_path;
|
||||||
PathService::Get(base::FILE_EXE, &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.push_back(app.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
argv.insert(argv.end(), args.begin(), args.end());
|
||||||
|
|
||||||
return relauncher::RelaunchApp(argv);
|
return relauncher::RelaunchApp(argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,8 @@ class Browser : public WindowListObserver {
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
// Restart the app.
|
// Restart the app.
|
||||||
bool Relaunch(const base::FilePath& app,
|
bool Relaunch(bool override_argv,
|
||||||
|
const base::FilePath& app,
|
||||||
const relauncher::StringVector& args);
|
const relauncher::StringVector& args);
|
||||||
|
|
||||||
// Focus the application.
|
// Focus the application.
|
||||||
|
|
|
@ -31,7 +31,7 @@ HANDLE GetParentProcessHandle(base::ProcessHandle handle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PROCESS_BASIC_INFORMATION pbi;
|
PROCESS_BASIC_INFORMATION pbi;
|
||||||
LONG status = NtQueryInformationProcess(
|
LONG status = NtQueryInformationProcess(
|
||||||
handle, ProcessBasicInformation,
|
handle, ProcessBasicInformation,
|
||||||
&pbi, sizeof(PROCESS_BASIC_INFORMATION), NULL);
|
&pbi, sizeof(PROCESS_BASIC_INFORMATION), NULL);
|
||||||
if (!NT_SUCCESS(status)) {
|
if (!NT_SUCCESS(status)) {
|
||||||
|
|
Loading…
Reference in a new issue