Hi
I found a strange bug. It looks like the trash has to be "initialized" for external drives. Here's what happens:
1. I (re)boot my machine (important once it's fixed it will only happen again after reboot)
2. I move any file from an external drive to the trash using NC. Let's say File1.txt
3. I don't see File1.txt in the bin, the file is gone from the original place it looks like we deleted it completely, but actually it is in an invisible trash right now where we cannot access or even permanently delete it.
4. Now I move any file from the same external drive to trash using Finder.
5. At this point I see both File1.txt and the file I deleted using Finder.
6. From now on the trash works as expected.
I am using Catalina 10.15.7 on a Mac mini 2018 and Nimble Commander v. 1.2.9
Move to trash from external HDs [FIXED]
Re: Move to trash from external HDs
Hi, thanks for pointing my attention to the issue.
The problem is that at the moment NC determines if a volume has Trash upfront, i.e. regardless of whether it could be created later by the system.
So in your case the UI is a bit different when you are dealing with a fresh drive - NC doesn't even try to move to trash, instead it says "Delete Permanently".
Once it sees a drive connected when it already has the ".Trashes" directory - it starts to offer moving to trash.
I'm still trying to figure out how to fix it without changing the existing workflow much.
The problem is that at the moment NC determines if a volume has Trash upfront, i.e. regardless of whether it could be created later by the system.
So in your case the UI is a bit different when you are dealing with a fresh drive - NC doesn't even try to move to trash, instead it says "Delete Permanently".
Once it sees a drive connected when it already has the ".Trashes" directory - it starts to offer moving to trash.
I'm still trying to figure out how to fix it without changing the existing workflow much.
Re: Move to trash from external HDs
I fixed it by opportunistically trying to trash on local volumes (not network mounts) even if the ".Trash"/".Trashes"/etc folder wasn't initialised yet.
Next preview/release build should behave correctly.
Next preview/release build should behave correctly.
Re: Move to trash from external HDs [FIXED]
There is a system API for moving files to the trash: https://github.com/sindresorhus/macos-trash
I've tested the trash CLI, and the system will auto-create a .Trashes or .Trash directory, if it doesn't exist. Seems to be very simple in terms of the code.
However, it doesn't work for write-protected files. Then you'd have to escalate privileges, and then the file would wind up in /private/var/root/.Trash instead, which is not what you want.
I can't say how Finder does it, i.e. select a file belonging to root:wheel for move-to-trash, enter admin password, and the file winds up in your user's Trash, i.e. usually ~/.Trash.
I've tested the trash CLI, and the system will auto-create a .Trashes or .Trash directory, if it doesn't exist. Seems to be very simple in terms of the code.
However, it doesn't work for write-protected files. Then you'd have to escalate privileges, and then the file would wind up in /private/var/root/.Trash instead, which is not what you want.
I can't say how Finder does it, i.e. select a file belonging to root:wheel for move-to-trash, enter admin password, and the file winds up in your user's Trash, i.e. usually ~/.Trash.
Re: Move to trash from external HDs [FIXED]
Slightly related (in terms of trash functionality): viewtopic.php?f=6&t=565
Re: Move to trash from external HDs [FIXED]
Thank you very much. I noticed the change and it works great for me.