mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -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
|
FOF_NOERRORUI = 1024
|
||||||
|
|
||||||
def send2trash(path):
|
def send2trash(path):
|
||||||
|
opath = path
|
||||||
if not isinstance(path, unicode):
|
if not isinstance(path, unicode):
|
||||||
path = unicode(path, u'mbcs')
|
path = unicode(path, u'mbcs')
|
||||||
if not op.isabs(path):
|
if not op.isabs(path):
|
||||||
|
@ -50,6 +51,7 @@ def send2trash(path):
|
||||||
fileop.lpszProgressTitle = None
|
fileop.lpszProgressTitle = None
|
||||||
result = SHFileOperationW(byref(fileop))
|
result = SHFileOperationW(byref(fileop))
|
||||||
if result:
|
if result:
|
||||||
msg = u"Couldn't perform operation. Error code: %d" % result
|
# user's system is broken, just delete
|
||||||
raise OSError(msg)
|
os.unlink(opath)
|
||||||
|
#msg = u"Couldn't perform operation. Error code: %d" % result
|
||||||
|
#raise OSError(msg)
|
||||||
|
|
Loading…
Reference in a new issue