Skip to content

Commit

Permalink
fix(validate): Ensure creation of directories uses abspath
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey committed Dec 11, 2024
1 parent ce2683d commit 72617d9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions honeybee/cli/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,14 @@ def _process_report_output(report, output_file):
if output_file is None:
return report
elif isinstance(output_file, str):
if not os.path.isdir(os.path.dirname(output_file)):
os.makedirs(os.path.dirname(output_file))
dir_name = os.path.dirname(os.path.abspath(output_file))
if not os.path.isdir(dir_name):
os.makedirs(dir_name)
with open(output_file, 'w') as of:
of.write(report)
else:
if 'stdout' not in str(output_file):
if not os.path.isdir(os.path.dirname(output_file.name)):
os.makedirs(os.path.dirname(output_file.name))
dir_name = os.path.dirname(os.path.abspath(output_file.name))
if not os.path.isdir(dir_name):
os.makedirs(dir_name)
output_file.write(report)

0 comments on commit 72617d9

Please sign in to comment.