diff --git a/automated_updates_data.json b/automated_updates_data.json index 2fa8e494dbb..b4011cd9a97 100644 --- a/automated_updates_data.json +++ b/automated_updates_data.json @@ -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-07-28", + "summary": "Improved filesystem docs: documented 'Read a directory' action, load-text normalize option, executable-file/user-home/path-parsing expressions, fixed duplicate delete heading, and fixed screenshot doc typo" } ] } diff --git a/docs/gdevelop5/all-features/filesystem/index.md b/docs/gdevelop5/all-features/filesystem/index.md index a53d7d5ad6a..178c0bbc231 100644 --- a/docs/gdevelop5/all-features/filesystem/index.md +++ b/docs/gdevelop5/all-features/filesystem/index.md @@ -160,6 +160,8 @@ 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. +** (Optional) Normalize the file content: ** When enabled (recommended, and enabled by default), Windows new line characters ("CRLF") are replaced by a single new line character, so that the loaded text behaves the same on every operating system. + --- #### Load a text from a file (async) @@ -172,6 +174,17 @@ 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. +** (Optional) Normalize the file content: ** When enabled (recommended, and enabled by default), Windows new line characters ("CRLF") are replaced by a single new line character, so that the loaded text behaves the same on every operating system. + +--- + +#### Read a directory +This action reads the contents of a directory (all files and sub-directories it contains) and stores their names in an array variable. +== Parameters == +** Directory path: ** The absolute path to the directory to read. + +** (Optional) Variable to store the result: ** The variable is filled with an array of the names of all files and sub-directories found in the directory. If an error occurs (for example the directory does not exist), the variable is set to the text `"error"` instead. + --- #### Delete a file @@ -184,7 +197,7 @@ It is advised to use the expressions for special folders (see below) to keep you --- -#### Delete a file +#### Delete a file (async) This action deletes the file at the given file path __asynchronously__. == Parameters == ** File path: ** The path on the file system where the file is located. @@ -202,8 +215,10 @@ This expression returns the operating system independent path to the _Desktop_ f #### Documents folder This expression returns the operating system independent path to the _Documents_ folder of the user that runs your game. This is the standard folder for storing documents. -#### This games executable folder +#### Game 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 (including the file name), rather than the folder containing it. #### 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. @@ -213,10 +228,21 @@ This folder is used for temporary files that your operating system can delete at #### Userdata folder This expression returns the operating system independent path to the _UserData_ folder of the user that runs your game. This folder is used for storing application settings. +#### User home folder +This expression returns the operating system independent path to the home folder of the user that runs your game (for example `C:\Users\Name` on Windows or `/home/name` on Linux). #### Path delimiter 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 extract the different parts of an existing path: + +#### Get directory name from a path +This expression returns the portion of a path that represents the directories, without the trailing file name. +#### Get file name from a path +This expression returns the name of the file (with its extension, if any) contained in a path. +#### Get the extension from a file path +This expression returns the extension of the file designated by a path, including the leading period (for example `".txt"`). + ## Example In order to save a screenshot to the _Pictures_ directory you could write: diff --git a/docs/gdevelop5/all-features/screenshot/index.md b/docs/gdevelop5/all-features/screenshot/index.md index bb4518a4228..2971e6cf580 100644 --- a/docs/gdevelop5/all-features/screenshot/index.md +++ b/docs/gdevelop5/all-features/screenshot/index.md @@ -17,7 +17,7 @@ Use this action to save a screenshot of everything which is currently drawn on t **Save path**: The file path where the screenshot should be saved. -The save path needs to be an absolute path on the file system (Like "C:\MyFolder\MyScreenshot.png" on Windows)' +The save path needs to be an absolute path on the file system (like "C:\MyFolder\MyScreenshot.png" on Windows). Relative paths are not supported.