diff --git a/scripts/file_operations.py b/scripts/file_operations.py index 62b3dc4b..81ad4715 100644 --- a/scripts/file_operations.py +++ b/scripts/file_operations.py @@ -31,6 +31,9 @@ def read_file(filename): def write_to_file(filename, text): try: filepath = safe_join(working_directory, filename) + directory = os.path.dirname(filepath) + if not os.path.exists(directory): + os.makedirs(directory) with open(filepath, "w") as f: f.write(text) return "File written to successfully."