[Python-ideas] Adding `pathlib.Path` method that would send file to recycle bin

Andrew Barnert abarnert at yahoo.com
Fri Jan 2 21:01:08 CET 2015


On Jan 2, 2015, at 14:36, random832 at fastmail.us wrote:

> On Thu, Jan 1, 2015, at 10:37, Andrew Barnert wrote:
>> On Linux, it's not exactly like Mac, but it's similar. Linux has no
>> notion of trash at all; desktop environments like GNOME do. And if you
>> want it to work exactly like the way GNOME does, you call the API via
>> GObject; otherwise you have to implement a complicated approximation
>> based on rename that won't be fully functional.
> 
> There is an actual standard for the Trash system that all three major
> desktop environments implement, so your "complicated approximation based
> on rename" can actually be correct rather than an approximation. If
> that's not exactly like how GNOME does it, then GNOME is incorrect.

First, XDG specifications are explicitly not standards (and XDG Trash is a draft extension proposal to those specs) so there is not an actual standard.

But, far more importantly, there are large areas that the spec leaves open to the implementation, or open for future expansion, that GNOME (and KDE) fills in with appropriate behavior. I gave one example earlier in the thread, which I picked by pointing my finger at one random paragraph from the spec. If you read through it, there are plenty of others.

If you call the APIs via GObject or Qt on a GNOME or KDE system, you will get the exact same behavior as everything else on the system. If you implement it yourself and ignore what GNOME and KDE do, nobody's going to care that you're 100% compliant with a draft spec proposal, they're going to care that your app refuses to trash something that everything else can trash (or, worse, that your app trashes it by copying 8GB over the network).


More information about the Python-ideas mailing list