Skip to content

Commit 563b7c7

Browse files
committed
fix: Ensure output directory exists before writing BBCode file
1 parent 4105737 commit 563b7c7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

markdown_to_bbcode.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,8 @@ def main():
341341
output_path = generate_output_filename(input_path, bbcode_type, output_folder)
342342

343343
try:
344+
if not os.path.exists(os.path.dirname(output_path)):
345+
os.makedirs(os.path.dirname(output_path), exist_ok=True)
344346
with open(output_path, 'w', encoding='utf-8') as outfile:
345347
outfile.write(bbcode_result)
346348
print(f"Successfully converted '{input_path}' to '{output_path}'.")

0 commit comments

Comments
 (0)