Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion main_no_modal.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,14 @@ def write_file(filename, filecode, directory):
print("\033[94m" + filename + "\033[0m")
print(filecode)

file_path = directory + "/" + filename
file_path = os.path.join(directory, filename)
dir = os.path.dirname(file_path)

# Check if the filename is actually a directory
if os.path.isdir(file_path):
print(f"Error: {filename} is a directory, not a file.")
return

os.makedirs(dir, exist_ok=True)

# Open the file in write mode
Expand Down