create destination directory if it does not exist

This commit is contained in:
Marcus Stoegbauer 2019-10-19 23:19:27 +02:00
parent 55829ad298
commit 82132e78f5
1 changed files with 6 additions and 1 deletions

View File

@ -47,7 +47,6 @@ def workconf(directory, depth=2):
for d in dirs:
name = directory+"/"+d
if os.path.isdir(name):
# fixme: create name if it does not exist
workconf(name, depth+1)
if name.endswith(".swp"):
continue
@ -167,6 +166,12 @@ def process_all_files(destfiles, dir_config):
debug.debug(" ================ process_all_files ===============", 1)
for df in destfiles.keys():
debug.debug(" ??? Processing source files for %s." % df, 2)
if not os.path.exists(os.path.dirname(df)):
debug.debug(" +++ Directory %s does not exist, creating" % os.path.dirname(df), 1)
os.mkdir(os.path.dirname(df))
if not os.path.isdir(os.path.dirname(df)):
debug.debug(" --- Destination directory %s does not exist, skipping." % os.path.dirname(df), 1)
return False
# assemble file to tmp
commentstring = ""
if dir_config.check("Main", "commentstring"):