mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-05 22:23:42 +02:00
Fix save to disk with books on an MTP device not working on windows.
This commit is contained in:
parent
394ef2d785
commit
9d73fd3750
1 changed files with 3 additions and 4 deletions
|
|
@ -591,12 +591,11 @@ def remove_books_from_metadata(self, paths, booklists):
|
|||
def _save_books(self, paths, target):
|
||||
'''Copy books from device to disk'''
|
||||
for path in paths:
|
||||
name = path.rpartition(os.sep)[2]
|
||||
name = ascii_filename(os.path.basename(path))
|
||||
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()
|
||||
with open(dest, 'wb') as f:
|
||||
self.device.get_file(path, f)
|
||||
|
||||
def save_books(self, done, paths, target, add_as_step_to_job=None):
|
||||
return self.create_job_step(self._save_books, done, args=[paths, target],
|
||||
|
|
|
|||
Loading…
Reference in a new issue