mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-18 22:44:21 +01:00
Merge pull request #81 from yousefissa/yi-write-to-file
Fix: create file dir if it doesnt exist during write_to_file
This commit is contained in:
@@ -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."
|
||||
|
||||
Reference in New Issue
Block a user