New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shell.moveItemToTrash does not work when Recycle Bin is disabled #4974
Comments
/cc @felixrieseberg |
Did a quick investigation: This won't be easy. |
Hey guys, Any progress on this issue yet? Just wanted to add that this is an issue for OS X too. I have almost no experience with objective-C coding, so unfortunately can't be much help coding/testing wise. However, just browsing around the web a bit (here, just search for NSFileManager Trash APIs), I noticed that there is a NSFeatureUnsupportedError returned if trash isn't supported for the volume. Perhaps we can make a change in the bool MoveItemToTrash(const base::FilePath& full_path) {
NSString* path_string = base::SysUTF8ToNSString(full_path.value());
BOOL status = [[NSFileManager defaultManager]
trashItemAtURL:[NSURL fileURLWithPath:path_string]
resultingItemURL:nil
error:nil];
// Check if error = NSFeatureUnsupportedError.
// If so, make a call to removeItemAtPath instead to directly delete the file.
// Otherwise, continue as normal.
if (!path_string || !status)
LOG(WARNING) << "NSWorkspace failed to move file " << full_path.value()
<< " to trash";
return status;
} There may be a bit more work involved with error messages/logging, but is there anyone who could try this out? |
This is a rather crippling issue, but thankfully a workaround exists for Windows (see atom/tree-view#856 (comment)). |
closing due to abandonment. |
@codebytere would you mind reopening this? I originally opened it on behalf of Atom (atom/tree-view#856), and it appears that this is still a bug on at least Electron 1.6.9. |
Deleted auto-reply emails |
@50Wliu for sure! we're just making an effort to weed out abandoned issues :) |
We are no longer implementing bugfixes for versions of Electron <= |
@codebytere I can confirm that this is still an issue using Electron 2.0.9. To test, I set the Recycle Bin to delete all items automatically, then opened Atom and attempted to delete a file using the Tree View. The operation failed. |
Thank you for taking the time to report this issue and helping to make Electron better. The version of Electron you reported this on has been superseded by newer releases. If you're still experiencing this issue in Electron v4.2.x or later, please add a comment specifying the version you're testing with and any other new information that a maintainer trying to reproduce the issue should know. I'm setting the Thanks in advance! Your help is appreciated. |
Closing as we've implemented this on macOS with #19700 and Windows is not possible at this time. |
I have the Recycle Bin set up to immediately delete files. This seems to cause
shell.moveItemToTrash()
to fail. As this is a native Windows option (at least for Windows 7+), it should be supported.The text was updated successfully, but these errors were encountered: