Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions automated_updates_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@
{
"date": "2026-07-07",
"summary": "Improved keyboard docs: added 'Key just pressed' (held vs one-frame) and 'Any key released' conditions, control-remapping note, and a reference list of valid key names"
},
{
"date": "2026-09-12",
"summary": "Improved filesystem docs: documented the 'Read a directory' action and added missing expressions (game executable file, user home folder, and directory/file/extension path parsing)"
}
]
}
22 changes: 22 additions & 0 deletions docs/gdevelop5/all-features/filesystem/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,16 @@ It is advised to use the expressions for special folders (see below) to keep you

** (Optional) Result variable: ** Variable to store the result. It can either hold the value 'ok': the task was successful or 'error': an error occurred. The variable will be updated, at the moment the file operation has finished.

---

#### Read a directory
This action reads the contents of a directory (all files and sub-directories) and stores them in an array __asynchronously__.
== Parameters ==
** Directory path: ** The absolute path to the directory to read.
It is advised to use the expressions for special folders (see below) to keep your game platform independent.

** (Optional) Result variable: ** Variable to store the result. It is set to `"error"` if an error occurred, otherwise it is set to an array containing the name of every file and sub-directory found in the directory. You can then loop over this array (for example with a [For each child variable](/gdevelop5/events/foreach-child-variable) event) to list save files, screenshots, mods, etc.

## Expressions
These expressions return the path to special folders on the users' operating system. If you use these expressions for loading and saving files it will be guaranteed to work on all supported operating systems. (Currently Windows, Linux, and macOS)
!!! tip
Expand All @@ -204,6 +214,10 @@ This expression returns the operating system independent path to the _Documents_
This is the standard folder for storing documents.
#### This games executable folder
This expression returns the operating system independent path to the folder where your game is being executed from.
#### Game executable file
This expression returns the operating system independent path to your game's executable file itself (not just the folder that contains it).
#### User's Home folder
This expression returns the operating system independent path to the home folder of the user that runs your game.
#### Pictures folder
This expression returns the operating system independent path to the _Pictures_ folder of the user that runs your game.
This is the standard folder for storing images.
Expand All @@ -217,6 +231,14 @@ This folder is used for storing application settings.
This expression returns the operating system independent path delimiter character. ("\" on Windows and "/" on Linux and macOS).
Use this expression to build cross-platform file paths that can be accessed on all supported operating systems.

The following expressions help you take an existing path apart, for example to display just the file name of a save the player picked:
#### Get directory name from a path
This expression takes a file or folder path and returns only the portion that represents the directories, without the ending file name.
#### Get file name from a path
This expression takes a file path and returns only the name of the file, including its extension (for example `save1.json`).
#### Get the extension from a file path
This expression takes a file path and returns only the extension of the file, including the leading period (for example `.txt`).

## Example
In order to save a screenshot to the _Pictures_ directory you could write:

Expand Down