feat: macOS removal fallback when moveItemToTrash fails (#19700)

* feat: macOS removal fallback when moveItemToTrash fails

* platform_util shouldn't know about mate::Arguments

* pull full_path from args as well
This commit is contained in:
Shelley Vohr 2019-08-13 12:31:53 -07:00 committed by GitHub
parent b5798326e8
commit e1824c00a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 43 additions and 13 deletions

View file

@ -71,6 +71,16 @@ v8::Local<v8::Promise> OpenExternal(const GURL& url, mate::Arguments* args) {
return handle;
}
bool MoveItemToTrash(mate::Arguments* args) {
base::FilePath full_path;
args->GetNext(&full_path);
bool delete_on_fail = false;
args->GetNext(&delete_on_fail);
return platform_util::MoveItemToTrash(full_path, delete_on_fail);
}
#if defined(OS_WIN)
bool WriteShortcutLink(const base::FilePath& shortcut_path,
mate::Arguments* args) {
@ -134,7 +144,7 @@ void Initialize(v8::Local<v8::Object> exports,
dict.SetMethod("showItemInFolder", &platform_util::ShowItemInFolder);
dict.SetMethod("openItem", &platform_util::OpenItem);
dict.SetMethod("openExternal", &OpenExternal);
dict.SetMethod("moveItemToTrash", &platform_util::MoveItemToTrash);
dict.SetMethod("moveItemToTrash", &MoveItemToTrash);
dict.SetMethod("beep", &platform_util::Beep);
#if defined(OS_WIN)
dict.SetMethod("writeShortcutLink", &WriteShortcutLink);