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:
parent
2d186cb31a
commit
a9475f3590
7 changed files with 42 additions and 35 deletions
|
@ -139,16 +139,16 @@ bool OpenItem(const base::FilePath& full_path) {
|
|||
launchIdentifiers:NULL];
|
||||
}
|
||||
|
||||
bool OpenExternal(const GURL& url, bool activate) {
|
||||
bool OpenExternal(const GURL& url, const OpenExternalOptions& options) {
|
||||
DCHECK([NSThread isMainThread]);
|
||||
NSURL* ns_url = net::NSURLWithGURL(url);
|
||||
if (ns_url)
|
||||
return OpenURL(ns_url, activate).empty();
|
||||
return OpenURL(ns_url, options.activate).empty();
|
||||
return false;
|
||||
}
|
||||
|
||||
void OpenExternal(const GURL& url,
|
||||
bool activate,
|
||||
const OpenExternalOptions& options,
|
||||
const OpenExternalCallback& callback) {
|
||||
NSURL* ns_url = net::NSURLWithGURL(url);
|
||||
if (!ns_url) {
|
||||
|
@ -157,13 +157,13 @@ void OpenExternal(const GURL& url,
|
|||
}
|
||||
|
||||
__block OpenExternalCallback c = callback;
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
|
||||
^{
|
||||
__block std::string error = OpenURL(ns_url, activate);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
c.Run(error);
|
||||
});
|
||||
});
|
||||
dispatch_async(
|
||||
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
__block std::string error = OpenURL(ns_url, options.activate);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
c.Run(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
bool MoveItemToTrash(const base::FilePath& full_path) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue