Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Instead of using our own Freedesktop's trash implementation, use gio when it's available.
- Loading branch information
Virgil Dupras
committed
Jul 19, 2013
1 parent
bb8ed83
commit baf125f
Showing
2 changed files
with
20 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright 2013 Hardcoded Software (http://www.hardcoded.net) | ||
|
||
# This software is licensed under the "BSD" License as described in the "LICENSE" file, | ||
# which should be included with this package. The terms are also available at | ||
# http://www.hardcoded.net/licenses/bsd_license | ||
|
||
from gi.repository import GObject, Gio | ||
|
||
def send2trash(path): | ||
try: | ||
f = Gio.File.new_for_path(path) | ||
f.trash(cancellable=None) | ||
except GObject.GError as e: | ||
raise OSError(e.message) |