mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
tolerate windows trash errors
This commit is contained in:
parent
bd8707f54c
commit
f270d2f26e
1 changed files with 5 additions and 3 deletions
8
thirdparty/send2trash/plat_win.py
vendored
8
thirdparty/send2trash/plat_win.py
vendored
|
@ -35,6 +35,7 @@ FOF_ALLOWUNDO = 64
|
|||
FOF_NOERRORUI = 1024
|
||||
|
||||
def send2trash(path):
|
||||
opath = path
|
||||
if not isinstance(path, unicode):
|
||||
path = unicode(path, u'mbcs')
|
||||
if not op.isabs(path):
|
||||
|
@ -50,6 +51,7 @@ def send2trash(path):
|
|||
fileop.lpszProgressTitle = None
|
||||
result = SHFileOperationW(byref(fileop))
|
||||
if result:
|
||||
msg = u"Couldn't perform operation. Error code: %d" % result
|
||||
raise OSError(msg)
|
||||
|
||||
# user's system is broken, just delete
|
||||
os.unlink(opath)
|
||||
#msg = u"Couldn't perform operation. Error code: %d" % result
|
||||
#raise OSError(msg)
|
||||
|
|
Loading…
Reference in a new issue