Creating new folder in my documents

Godot Version

Godot 4.3

Question

Hello godot community,
I’m trying to create a folder in
“c:/users/user/documents” to keep files created in my app organized.

So basically I need a way to check first if the folder exists, if it doesn’t create the folder.
Then when using the godot filedialog i want the default path to be the folder path that i created, for example “c:/users/user/documents/my_files”

If anyone could help me out i would appreciate it…

I would check here first… File paths in Godot projects — Godot Engine (stable) documentation in English

Godot uses user:// as the user file file path to read/write to. I am assuming you are developing a Windows app based on the file path you provided, but every OS has its own file path where user files are located. Other file paths may or may not exist or allow apps to write to.

That being said… Saving games — Godot Engine (stable) documentation in English provides an example of reading and writing files including checking whether a file exists.

1 Like

From what i understood, Godot allows reading/writing
data through script only to the user folder that you
can locate through:
Project > Open User Data Folder

However when using the filedialog node, you can manually
save files anywhere you want if you have selected on the
filedialog > inspector > Access > file system

On windows 11 the default path on the filedialog is the
path that the .exe file is located (your app).
If you try to change the default path with:
$FileDialog.set_current_dir(“C:/Users/User/Documents”)
it doesn’t work…

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.