Up to date
This page is up to date for Godot 4.1
.
If you still find outdated information, please open an issue.
File paths in Godot projects¶
This page explains how file paths work inside Godot projects. You will learn how
to access paths in your projects using the res://
and user://
notations,
and where Godot stores project and editor files on your and your users' systems.
Path separators¶
To make supporting multiple platforms easier, Godot uses UNIX-style path
separators (forward slash /
). These work on all platforms, including
Windows.
Instead of writing paths like C:\Projects\Game
, in Godot, you should write
C:/Projects/Game
.
Windows-style path separators (backward slash \
) are also supported in some
path-related methods, but they need to be doubled (\\
), as \
is normally
used as an escape for characters with a special meaning.
This makes it possible to work with paths returned by other Windows applications. We still recommend using only forward slashes in your own code to guarantee that everything will work as intended.
Accessing files in the project folder (res://
)¶
Godot considers that a project exists in any folder that contains a
project.godot
text file, even if the file is empty. The folder that contains
this file is your project's root folder.
You can access any file relative to it by writing paths starting with
res://
, which stands for resources. For example, you can access an image
file character.png
located in the project's root folder in code with the
following path: res://character.png
.
Accessing persistent user data (user://
)¶
To store persistent data files, like the player's save or settings, you want to
use user://
instead of res://
as your path's prefix. This is because
when the game is running, the project's file system will likely be read-only.
The user://
prefix points to a different directory on the user's device.
Unlike res://
, the directory pointed at by user://
is created
automatically and guaranteed to be writable to, even in an exported project.
The location of the user://
folder depends on what is configured in the
Project Settings:
By default, the
user://
folder is created within Godot's editor data path in theapp_userdata/[project_name]
folder. This is the default so that prototypes and test projects stay self-contained within Godot's data folder.If application/config/use_custom_user_dir is enabled in the Project Settings, the
user://
folder is created next to Godot's editor data path, i.e. in the standard location for applications data.By default, the folder name will be inferred from the project name, but it can be further customized with application/config/custom_user_dir_name. This path can contain path separators, so you can use it e.g. to group projects of a given studio with a
Studio Name/Game Name
structure.
On desktop platforms, the actual directory paths for user://
are:
Type |
Location |
---|---|
Default |
Windows:
%APPDATA%\Godot\app_userdata\[project_name] macOS:
~/Library/Application Support/Godot/app_userdata/[project_name] Linux:
~/.local/share/godot/app_userdata/[project_name] |
Custom dir |
Windows:
%APPDATA%\[project_name] macOS:
|