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

Andrew Barnert abarnert at yahoo.com
Fri Jan 2 21:05:51 CET 2015


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

> On Thu, Jan 1, 2015, at 17:59, Andrew Barnert wrote:
>> Of course you _could_ implement that full spec yourself in Python, right?
>> Well, read it. There are references to things "the implementation" may
>> do, like providing a way for the administrator to disable sticky-bit
>> checking for filesystems that don't support it. Do you know how to check
>> whether the administrator has disabled sticky-bit checking on a
>> filesystem?
> 
> A python implementation would be an independent implementation, and not
> bound by another implementation's (even on the same machine)
> implementation-specific decisions.

Then a Python implementation would be a bad implementation. The whole point of XDG is to make it easier to write desktop software that's consistent with other desktop software. So if you write some Qt software and I run it on a GNOME system, Qt follows (as best it can--which is better each version) the GNOME rules, and your GNOME-based settings, rather than ignoring them and pretending it's on a KDE system.

> There is therefore no reason the
> python implementation couldn't simply not provide such a method, and
> therefore any .Trash directory without the sticky bit set does not pass
> the checks,  and all that will happen is .Trash-$uid gets used instead -
> no harm done.

Except that if you can't create a .Trash-$uid, then you can't trash files on that filesystem even though Nautilus, etc. can. (And, needless to say, if you try to implement any other trash functionality, like listing trash contents or undeleting, you're going to be wrong there too.)


More information about the Python-ideas mailing list