mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix a bug in the Save to disk function that could cause saving of multiple books to fail on multi-core machines
This commit is contained in:
parent
a5ab3a2675
commit
3f745e44e1
@ -65,7 +65,14 @@ def debug_device_driver():
|
|||||||
from calibre.devices.scanner import DeviceScanner
|
from calibre.devices.scanner import DeviceScanner
|
||||||
s = DeviceScanner()
|
s = DeviceScanner()
|
||||||
s.scan()
|
s.scan()
|
||||||
print 'USB devices on system:\n', pprint.pprint(s.devices)
|
devices = s.devices
|
||||||
|
if not iswindows:
|
||||||
|
devices = [list(x) for x in devices]
|
||||||
|
for d in devices:
|
||||||
|
for i in range(3):
|
||||||
|
d[i] = hex(d[i])
|
||||||
|
|
||||||
|
print 'USB devices on system:\n', pprint.pprint(devices)
|
||||||
if iswindows:
|
if iswindows:
|
||||||
wmi = __import__('wmi', globals(), locals(), [], -1)
|
wmi = __import__('wmi', globals(), locals(), [], -1)
|
||||||
drives = []
|
drives = []
|
||||||
|
@ -14,7 +14,7 @@ class ESLICK(USBMS):
|
|||||||
name = 'ESlick Device Interface'
|
name = 'ESlick Device Interface'
|
||||||
gui_name = 'Foxit ESlick'
|
gui_name = 'Foxit ESlick'
|
||||||
description = _('Communicate with the ESlick eBook reader.')
|
description = _('Communicate with the ESlick eBook reader.')
|
||||||
author = _('Kovid Goyal')
|
author = 'Kovid Goyal'
|
||||||
supported_platforms = ['windows', 'osx', 'linux']
|
supported_platforms = ['windows', 'osx', 'linux']
|
||||||
|
|
||||||
# Ordered list of supported formats
|
# Ordered list of supported formats
|
||||||
|
@ -153,8 +153,14 @@ def save_book_to_disk(id, db, root, opts, length):
|
|||||||
base_path = os.path.join(root, *components)
|
base_path = os.path.join(root, *components)
|
||||||
base_name = os.path.basename(base_path)
|
base_name = os.path.basename(base_path)
|
||||||
dirpath = os.path.dirname(base_path)
|
dirpath = os.path.dirname(base_path)
|
||||||
if not os.path.exists(dirpath):
|
# Don't test for existence first are the test could fail but
|
||||||
|
# another worker process could create the directory before
|
||||||
|
# the call to makedirs
|
||||||
|
try:
|
||||||
os.makedirs(dirpath)
|
os.makedirs(dirpath)
|
||||||
|
except BaseException:
|
||||||
|
if not os.path.exists(dirpath):
|
||||||
|
raise
|
||||||
|
|
||||||
cdata = db.cover(id, index_is_id=True)
|
cdata = db.cover(id, index_is_id=True)
|
||||||
if opts.save_cover:
|
if opts.save_cover:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user