refactor: improve MoveItemToTrash error description (#23589)

This commit is contained in:
Shelley Vohr 2020-05-17 19:18:34 -07:00 committed by GitHub
parent 52b50e6b33
commit 75fd9a3496
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -137,13 +137,15 @@ bool MoveItemToTrash(const base::FilePath& full_path, bool delete_on_fail) {
// Handle this by deleting the item as a fallback.
if (!did_trash && [err code] == NSFeatureUnsupportedError) {
did_trash = [[NSFileManager defaultManager] removeItemAtURL:url
error:nil];
error:&err];
}
}
if (!did_trash)
if (!did_trash) {
LOG(WARNING) << "NSWorkspace failed to move file " << full_path.value()
<< " to trash";
<< " to trash: "
<< base::SysNSStringToUTF8([err localizedDescription]);
}
return did_trash;
}