From cc15b628a217b79b6357b0b000711dfdd4d585fa Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Tue, 6 Apr 2010 19:11:37 +0200 Subject: [PATCH] plat_other tries to see if an Ubuntu-style trash exists and uses it. --- send2trash/plat_other.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/send2trash/plat_other.py b/send2trash/plat_other.py index 5a681f5..40d85a5 100644 --- a/send2trash/plat_other.py +++ b/send2trash/plat_other.py @@ -2,8 +2,21 @@ from __future__ import unicode_literals import sys import os import os.path as op +import logging -TRASH_PATH = op.expanduser('~/.Trash') +CANDIDATES = [ + '~/.local/share/Trash/files', + '~/.Trash', +] + +for candidate in CANDIDATES: + candidate_path = op.expanduser(candidate) + if op.exists(candidate_path): + TRASH_PATH = candidate_path + break +else: + logging.warning("Can't find path for Trash") + TRASH_PATH = op.expanduser('~/.Trash') # XXX Make this work on external volumes