From 4c4d8b39f1acae5d49064f2af61b1ac870c8702e Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Fri, 15 Aug 2025 17:58:45 +0800 Subject: [PATCH] Clarify truncation behavior in file open modes --- doc/classes/FileAccess.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/classes/FileAccess.xml b/doc/classes/FileAccess.xml index 25db729cdbc..049d30bf547 100644 --- a/doc/classes/FileAccess.xml +++ b/doc/classes/FileAccess.xml @@ -580,14 +580,14 @@ Opens the file for read operations. The file cursor is positioned at the beginning of the file. - Opens the file for write operations. The file is created if it does not exist, and truncated if it does. + Opens the file for write operations. If the file exists, it is truncated to zero length and its contents are cleared. Otherwise, it is created. [b]Note:[/b] When creating a file it must be in an already existing directory. To recursively create directories for a file path, see [method DirAccess.make_dir_recursive]. Opens the file for read and write operations. Does not truncate the file. The file cursor is positioned at the beginning of the file. - Opens the file for read and write operations. The file is created if it does not exist, and truncated if it does. The file cursor is positioned at the beginning of the file. + Opens the file for read and write operations. If the file exists, it is truncated to zero length and its contents are cleared. Otherwise, it is created. The file cursor is positioned at the beginning of the file. [b]Note:[/b] When creating a file it must be in an already existing directory. To recursively create directories for a file path, see [method DirAccess.make_dir_recursive].