send2trash/send2trash/plat_win.py

21 lines
747 B
Python
Raw Normal View History

2017-08-04 00:52:19 +00:00
# Copyright 2017 Virgil Dupras
2010-04-07 06:52:24 +00:00
2017-08-04 00:52:19 +00:00
# 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
2010-04-07 06:52:24 +00:00
# http://www.hardcoded.net/licenses/bsd_license
from __future__ import unicode_literals
from platform import version
# if windows is vista or newer and pywin32 is available use IFileOperation
if int(version().split(".", 1)[0]) >= 6:
try:
# Attempt to use pywin32 to use IFileOperation
from .plat_win_modern import send2trash
except ImportError:
# use SHFileOperation as fallback
from .plat_win_legacy import send2trash
else:
# use SHFileOperation as fallback
from .plat_win_legacy import send2trash