feat: add workingDirectory option to shell.openExternal() (#15065)

Allows passing `workingDirectory` to the underlying `ShellExecuteW` API on Windows.

the motivation is that by default `ShellExecute` would use the current working directory, which would get locked on Windows and can prevent autoUpdater from working correctly. We need to be able specify a different `workingDirectory` to prevent this situation.
This commit is contained in:
Milan Burda 2018-10-10 22:46:54 +02:00 committed by Alexey Kuzmin
parent 2d186cb31a
commit a9475f3590
7 changed files with 42 additions and 35 deletions

View file

@ -60,11 +60,12 @@ bool OpenExternal(
const GURL& url,
#endif
mate::Arguments* args) {
bool activate = true;
platform_util::OpenExternalOptions options;
if (args->Length() >= 2) {
mate::Dictionary options;
if (args->GetNext(&options)) {
options.Get("activate", &activate);
mate::Dictionary obj;
if (args->GetNext(&obj)) {
obj.Get("activate", &options.activate);
obj.Get("workingDirectory", &options.working_dir);
}
}
@ -72,13 +73,13 @@ bool OpenExternal(
base::Callback<void(v8::Local<v8::Value>)> callback;
if (args->GetNext(&callback)) {
platform_util::OpenExternal(
url, activate,
url, options,
base::Bind(&OnOpenExternalFinished, args->isolate(), callback));
return true;
}
}
return platform_util::OpenExternal(url, activate);
return platform_util::OpenExternal(url, options);
}
#if defined(OS_WIN)