summaryrefslogtreecommitdiff
path: root/doc/classes/File.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/File.xml')
-rw-r--r--doc/classes/File.xml20
1 files changed, 10 insertions, 10 deletions
diff --git a/doc/classes/File.xml b/doc/classes/File.xml
index d91203d91f..ada57a8114 100644
--- a/doc/classes/File.xml
+++ b/doc/classes/File.xml
@@ -21,9 +21,11 @@
return content
[/codeblock]
In the example above, the file will be saved in the user data folder as specified in the [url=https://docs.godotengine.org/en/latest/tutorials/io/data_paths.html]Data paths[/url] documentation.
+ [b]Note:[/b] To access project resources once exported, it is recommended to use [ResourceLoader] instead of the [File] API, as some files are converted to engine-specific formats and their original source files might not be present in the exported PCK package.
</description>
<tutorials>
- <link>https://docs.godotengine.org/en/latest/getting_started/step_by_step/filesystem.html</link>
+ <link title="File system">https://docs.godotengine.org/en/latest/getting_started/step_by_step/filesystem.html</link>
+ <link title="3D Voxel Demo">https://godotengine.org/asset-library/asset/676</link>
</tutorials>
<methods>
<method name="close">
@@ -48,7 +50,7 @@
</argument>
<description>
Returns [code]true[/code] if the file exists in the given path.
- [b]Note:[/b] Many resources types are imported (e.g. textures or sound files), and that their source asset will not be included in the exported game, as only the imported version is used (in the [code]res://.import[/code] folder). To check for the existence of such resources while taking into account the remapping to their imported location, use [method ResourceLoader.exists]. Typically, using [code]File.file_exists[/code] on an imported resource would work while you are developing in the editor (the source asset is present in [code]res://[/code], but fail when exported).
+ [b]Note:[/b] Many resources types are imported (e.g. textures or sound files), and their source asset will not be included in the exported game, as only the imported version is used. See [method ResourceLoader.exists] for an alternative approach that takes resource remapping into account.
</description>
</method>
<method name="get_16" qualifiers="const">
@@ -398,8 +400,7 @@
<argument index="0" name="line" type="String">
</argument>
<description>
- Stores the given [String] as a line in the file.
- Text will be encoded as UTF-8.
+ Appends [code]line[/code] to the file followed by a line return character ([code]\n[/code]), encoding the text as UTF-8.
</description>
</method>
<method name="store_pascal_string">
@@ -427,8 +428,7 @@
<argument index="0" name="string" type="String">
</argument>
<description>
- Stores the given [String] in the file.
- Text will be encoded as UTF-8.
+ Appends [code]string[/code] to the file without a line return, encoding the text as UTF-8.
</description>
</method>
<method name="store_var">
@@ -451,16 +451,16 @@
</members>
<constants>
<constant name="READ" value="1" enum="ModeFlags">
- Opens the file for read operations.
+ Opens the file for read operations. The cursor is positioned at the beginning of the file.
</constant>
<constant name="WRITE" value="2" enum="ModeFlags">
- Opens the file for write operations. Create it if the file does not exist and truncate if it exists.
+ Opens the file for write operations. The file is created if it does not exist, and truncated if it does.
</constant>
<constant name="READ_WRITE" value="3" enum="ModeFlags">
- Opens the file for read and write operations. Does not truncate the file.
+ Opens the file for read and write operations. Does not truncate the file. The cursor is positioned at the beginning of the file.
</constant>
<constant name="WRITE_READ" value="7" enum="ModeFlags">
- Opens the file for read and write operations. Create it if the file does not exist and truncate if it exists.
+ Opens the file for read and write operations. The file is created if it does not exist, and truncated if it does. The cursor is positioned at the beginning of the file.
</constant>
<constant name="COMPRESSION_FASTLZ" value="0" enum="CompressionMode">
Uses the [url=http://fastlz.org/]FastLZ[/url] compression method.