Skip to content

Commit

Permalink
cli: Always create destination directory before writing output
Browse files Browse the repository at this point in the history
The existing routines only created the directory specified by
``--output-directory``, if any.
  • Loading branch information
cpitclaudel committed Aug 24, 2021
1 parent ecd22a6 commit 6a35af2
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions alectryon/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ def write_output(ext, contents, fname, input_is_stdin, output, output_directory)
else:
if not output:
output = os.path.join(output_directory, strip_extension(fname) + ext)
os.makedirs(os.path.dirname(os.path.abspath(output)), exist_ok=True)
with open(output, mode="w", encoding="utf-8") as f:
f.write(contents)

Expand Down

0 comments on commit 6a35af2

Please sign in to comment.