gvfs-trash error message when unable to create trash directory is unhelpful
Submitted by James B
Overview: When attempting to use
gvfs-trash on a partition where trashing a file is not currently possible, the error message does not explain how to correct the problem.
Reproducing: Set up a mount so the user does not have write access to the partition root, and
/path/to/mount/.Trash-$UID does not exist, or is not writable. Create another directory under
/path/to/mount/ where the user does have write permissions, then attempt to
gvfs-trash a file under there.
Results: Generic error message "Error trashing file: Unable to find or create trash directory".
Expected: Don't assume every user has read the Freedesktop Trash spec, or understands which partition holds the file they're trying to delete. Tell me where you're trying to create a trash directory, at a minimum. Ideally, offer an environment variable or config-file setting that treats "can't create trash directory on this mount" as "this mount doesn't support trash at all" (which I believe is the case for certain kinds of network mount?).
I wound up here because Visual Studio Code (and other Electron-based editors like Atom) uses
gvfs-trash under the hood, and surfaces the problem as a generic "failed to move your file to the trash" error. More detail from
gvfs-trash would allow them to show a more helpful error message to the user.