diff --git a/atom/common/platform_util_mac.mm b/atom/common/platform_util_mac.mm index a1f17d7c9d5c..1aa75effd35b 100644 --- a/atom/common/platform_util_mac.mm +++ b/atom/common/platform_util_mac.mm @@ -140,17 +140,12 @@ bool OpenExternal(const GURL& url) { } bool MoveItemToTrash(const base::FilePath& full_path) { - DCHECK([NSThread isMainThread]); NSString* path_string = base::SysUTF8ToNSString(full_path.value()); - NSArray* file_array = - [NSArray arrayWithObject:[path_string lastPathComponent]]; - BOOL status = [[NSWorkspace sharedWorkspace] - performFileOperation:NSWorkspaceRecycleOperation - source:[path_string stringByDeletingLastPathComponent] - destination:@"" - files:file_array - tag:nil]; - if (!path_string || !file_array || !status) + BOOL status = [[NSFileManager defaultManager] + trashItemAtURL:[NSURL fileURLWithPath:path_string] + resultingItemURL:nil + error:nil]; + if (!path_string || !status) LOG(WARNING) << "NSWorkspace failed to move file " << full_path.value() << " to trash"; return status;