mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge branch 'makedirs-crash' of https://github.com/keszybz/calibre
This commit is contained in:
commit
0db1b7662d
@ -17,8 +17,6 @@ from polyglot.builtins import unicode_type
|
|||||||
|
|
||||||
|
|
||||||
config_dir = os.path.join(config_dir, 'conversion')
|
config_dir = os.path.join(config_dir, 'conversion')
|
||||||
if not os.path.exists(config_dir):
|
|
||||||
os.makedirs(config_dir)
|
|
||||||
|
|
||||||
|
|
||||||
def name_to_path(name):
|
def name_to_path(name):
|
||||||
@ -28,6 +26,9 @@ def name_to_path(name):
|
|||||||
def save_defaults(name, recs):
|
def save_defaults(name, recs):
|
||||||
path = name_to_path(name)
|
path = name_to_path(name)
|
||||||
raw = recs.serialize()
|
raw = recs.serialize()
|
||||||
|
|
||||||
|
os.makedirs(config_dir, exist_ok=True)
|
||||||
|
|
||||||
with lopen(path, 'wb'):
|
with lopen(path, 'wb'):
|
||||||
pass
|
pass
|
||||||
with ExclusiveFile(path) as f:
|
with ExclusiveFile(path) as f:
|
||||||
@ -36,6 +37,9 @@ def save_defaults(name, recs):
|
|||||||
|
|
||||||
def load_defaults(name):
|
def load_defaults(name):
|
||||||
path = name_to_path(name)
|
path = name_to_path(name)
|
||||||
|
|
||||||
|
os.makedirs(config_dir, exist_ok=True)
|
||||||
|
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
open(path, 'wb').close()
|
open(path, 'wb').close()
|
||||||
with ExclusiveFile(path) as f:
|
with ExclusiveFile(path) as f:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user