Skip to content

Commit 4007e21

Browse files
committed
🐛 check that output dir is a file and create directory if it does not exist
1 parent a7de476 commit 4007e21

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/vuegen/report_generator.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ def get_report(
6060
output_dir = Path(".")
6161
else:
6262
output_dir = Path(output_dir)
63+
if output_dir.is_file():
64+
raise ValueError(
65+
"The output_dir parameter should be a directory, not a file."
66+
)
67+
if not output_dir.exists():
68+
logger.info("Creating output directory: %s", output_dir)
69+
output_dir.mkdir(parents=True, exist_ok=True)
70+
6371
# Initialize logger only if it's not provided
6472
if logger is None:
6573
_folder = "logs"

0 commit comments

Comments
 (0)