Fix save to disk with books on an MTP device not working on windows.

This commit is contained in:
Kovid Goyal 2013-08-30 09:53:31 +05:30
parent 394ef2d785
commit 9d73fd3750

View File

@ -591,12 +591,11 @@ class DeviceManager(Thread): # {{{
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],