mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
py3 compat for the recycle bin process
This commit is contained in:
parent
860bcf0088
commit
d880ea2a9c
@ -60,7 +60,8 @@ if iswindows:
|
|||||||
raise ValueError('Cannot recycle paths that have newlines in them (%r)' % path)
|
raise ValueError('Cannot recycle paths that have newlines in them (%r)' % path)
|
||||||
with rlock:
|
with rlock:
|
||||||
start_recycler()
|
start_recycler()
|
||||||
eintr_retry_call(print, path.encode('utf-8'), file=recycler.stdin)
|
recycler.stdin.write(path.encode('utf-8'))
|
||||||
|
recycler.stdin.write(b'\n')
|
||||||
recycler.stdin.flush()
|
recycler.stdin.flush()
|
||||||
# Theoretically this could be made non-blocking using a
|
# Theoretically this could be made non-blocking using a
|
||||||
# thread+queue, however the original implementation was blocking,
|
# thread+queue, however the original implementation was blocking,
|
||||||
|
@ -206,7 +206,7 @@ winutil_move_to_trash(PyObject *self, PyObject *args) {
|
|||||||
|
|
||||||
CComPtr<IShellItem> delete_item;
|
CComPtr<IShellItem> delete_item;
|
||||||
if (FAILED(SHCreateItemFromParsingName(path.ptr(), NULL, IID_PPV_ARGS(&delete_item)))) {
|
if (FAILED(SHCreateItemFromParsingName(path.ptr(), NULL, IID_PPV_ARGS(&delete_item)))) {
|
||||||
PyErr_SetString(PyExc_OSError, "Failed to create shell item");
|
PyErr_Format(PyExc_OSError, "Failed to create shell item for path: %R", PyTuple_GET_ITEM(args, 0));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user