create file parents if they don't exist

This commit is contained in:
Khaleel Al-Adhami 2025-01-24 12:23:05 -08:00
parent a3423ae089
commit 64a6892fab

View File

@ -196,6 +196,9 @@ def update_json_file(file_path: str | Path, update_dict: dict[str, int | str]):
"""
fp = Path(file_path)
# Create the parent directory if it doesn't exist.
fp.parent.mkdir(parents=True, exist_ok=True)
# Create the file if it doesn't exist.
fp.touch(exist_ok=True)