From 64a6892fab3622ce7eabe9cd0bd100fe0fa398d6 Mon Sep 17 00:00:00 2001 From: Khaleel Al-Adhami Date: Fri, 24 Jan 2025 12:23:05 -0800 Subject: [PATCH] create file parents if they don't exist --- reflex/utils/path_ops.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/reflex/utils/path_ops.py b/reflex/utils/path_ops.py index b447718d2..e3256bb45 100644 --- a/reflex/utils/path_ops.py +++ b/reflex/utils/path_ops.py @@ -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)