mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Use move rather than rename for trashing files on Linux
Move defaults to using rename under the hood but is more robust on borked systems where trash is not on the same filesystem
This commit is contained in:
parent
1e905098be
commit
96a77a59c4
@ -21,6 +21,7 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
||||
import os, stat
|
||||
import os.path as op
|
||||
from datetime import datetime
|
||||
import shutil
|
||||
|
||||
from polyglot.builtins import unicode_type
|
||||
from polyglot.urllib import quote
|
||||
@ -89,7 +90,7 @@ def trash_move(src, dst, topdir=None):
|
||||
check_create(filespath)
|
||||
check_create(infopath)
|
||||
|
||||
os.rename(src, op.join(filespath, destname))
|
||||
shutil.move(src, op.join(filespath, destname))
|
||||
with open(op.join(infopath, destname + INFO_SUFFIX), 'wb') as f:
|
||||
data = info_for(src, topdir)
|
||||
if not isinstance(data, bytes):
|
||||
|
Loading…
x
Reference in New Issue
Block a user