Skip to content

Commit 6a35af2

Browse files
committed
cli: Always create destination directory before writing output
The existing routines only created the directory specified by ``--output-directory``, if any.
1 parent ecd22a6 commit 6a35af2

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

alectryon/cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ def write_output(ext, contents, fname, input_is_stdin, output, output_directory)
356356
else:
357357
if not output:
358358
output = os.path.join(output_directory, strip_extension(fname) + ext)
359+
os.makedirs(os.path.dirname(os.path.abspath(output)), exist_ok=True)
359360
with open(output, mode="w", encoding="utf-8") as f:
360361
f.write(contents)
361362

0 commit comments

Comments
 (0)