mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Prevent truncating of files when using save file to disk to save a file to itself.
This commit is contained in:
parent
4f0dc1d8c7
commit
c52966ffa4
@ -220,9 +220,11 @@ class DeviceManager(Thread):
|
||||
'''Copy books from device to disk'''
|
||||
for path in paths:
|
||||
name = path.rpartition('/')[2]
|
||||
f = open(os.path.join(target, name), 'wb')
|
||||
self.device.get_file(path, f)
|
||||
f.close()
|
||||
dest = os.path.join(target, name)
|
||||
if os.path.abspath(dest) != os.path.abspath(path):
|
||||
f = open(dest, 'wb')
|
||||
self.device.get_file(path, f)
|
||||
f.close()
|
||||
|
||||
def save_books(self, done, paths, target):
|
||||
return self.create_job(self._save_books, done, args=[paths, target],
|
||||
|
Loading…
x
Reference in New Issue
Block a user