2017-08-03 19:52:19 -05:00
|
|
|
# Copyright 2017 Virgil Dupras
|
2010-04-07 01:52:24 -05:00
|
|
|
|
2017-08-03 19:52:19 -05: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 01:52:24 -05:00
|
|
|
# http://www.hardcoded.net/licenses/bsd_license
|
|
|
|
|
2013-07-19 17:42:32 -05:00
|
|
|
from __future__ import unicode_literals
|
2020-06-03 11:49:41 -05:00
|
|
|
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
|
2022-04-30 19:52:09 -05:00
|
|
|
from .modern import send2trash
|
2020-06-03 11:49:41 -05:00
|
|
|
except ImportError:
|
|
|
|
# use SHFileOperation as fallback
|
2022-04-30 19:52:09 -05:00
|
|
|
from .legacy import send2trash
|
2020-06-03 11:49:41 -05:00
|
|
|
else:
|
|
|
|
# use SHFileOperation as fallback
|
2022-04-30 19:52:09 -05:00
|
|
|
from .legacy import send2trash # noqa: F401
|