feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
|
|
@ -5,7 +5,7 @@
|
|||
</brief_description>
|
||||
<description>
|
||||
This class can be used to permanently store data in the user device's file system and to read from it. This is useful for storing game save data or player configuration files.
|
||||
Here's a sample on how to write and read from a file:
|
||||
[b]Example:[/b] How to write and read from a file. The file named [code]"save_game.dat"[/code] will be stored in the user data folder, as specified in the [url=$DOCS_URL/tutorials/io/data_paths.html]Data paths[/url] documentation:
|
||||
[codeblocks]
|
||||
[gdscript]
|
||||
func save_to_file(content):
|
||||
|
|
@ -32,10 +32,9 @@
|
|||
}
|
||||
[/csharp]
|
||||
[/codeblocks]
|
||||
In the example above, the file will be saved in the user data folder as specified in the [url=$DOCS_URL/tutorials/io/data_paths.html]Data paths[/url] documentation.
|
||||
[FileAccess] will close when it's freed, which happens when it goes out of scope or when it gets assigned with [code]null[/code]. [method close] can be used to close it before then explicitly. In C# the reference must be disposed manually, which can be done with the [code]using[/code] statement or by calling the [code]Dispose[/code] method directly.
|
||||
A [FileAccess] instance will close its file when the instance is freed. Since it inherits [RefCounted], this happens automatically when it is no longer in use. [method close] can be called to close it earlier. In C#, the reference must be disposed manually, which can be done with the [code]using[/code] statement or by calling the [code]Dispose[/code] method directly.
|
||||
[b]Note:[/b] To access project resources once exported, it is recommended to use [ResourceLoader] instead of [FileAccess], as some files are converted to engine-specific formats and their original source files might not be present in the exported PCK package. If using [FileAccess], make sure the file is included in the export by changing its import mode to [b]Keep File (exported as is)[/b] in the Import dock, or, for files where this option is not available, change the non-resource export filter in the Export dialog to include the file's extension (e.g. [code]*.txt[/code]).
|
||||
[b]Note:[/b] Files are automatically closed only if the process exits "normally" (such as by clicking the window manager's close button or pressing [b]Alt + F4[/b]). If you stop the project execution by pressing [b]F8[/b] while the project is running, the file won't be closed as the game process will be killed. You can work around this by calling [method flush] at regular intervals.
|
||||
[b]Note:[/b] Files are automatically closed only if the process exits "normally" (such as by clicking the window manager's close button or pressing [kbd]Alt + F4[/kbd]). If you stop the project execution by pressing [kbd]F8[/kbd] while the project is running, the file won't be closed as the game process will be killed. You can work around this by calling [method flush] at regular intervals.
|
||||
</description>
|
||||
<tutorials>
|
||||
<link title="File system">$DOCS_URL/tutorials/scripting/filesystem.html</link>
|
||||
|
|
@ -123,6 +122,13 @@
|
|||
Returns the next 64 bits from the file as an integer. See [method store_64] for details on what values can be stored and retrieved this way.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_access_time" qualifiers="static">
|
||||
<return type="int" />
|
||||
<param index="0" name="file" type="String" />
|
||||
<description>
|
||||
Returns the last time the [param file] was accessed in Unix timestamp format, or [code]0[/code] on error. This Unix timestamp can be converted to another format using the [Time] singleton.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_as_text" qualifiers="const">
|
||||
<return type="String" />
|
||||
<param index="0" name="skip_cr" type="bool" default="false" />
|
||||
|
|
@ -280,6 +286,13 @@
|
|||
Returns an SHA-256 [String] representing the file at the given path or an empty [String] on failure.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_size" qualifiers="static">
|
||||
<return type="int" />
|
||||
<param index="0" name="file" type="String" />
|
||||
<description>
|
||||
Returns file size in bytes, or [code]-1[/code] on error.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_unix_permissions" qualifiers="static">
|
||||
<return type="int" enum="FileAccess.UnixPermissionFlags" is_bitfield="true" />
|
||||
<param index="0" name="file" type="String" />
|
||||
|
|
@ -555,8 +568,7 @@
|
|||
<members>
|
||||
<member name="big_endian" type="bool" setter="set_big_endian" getter="is_big_endian">
|
||||
If [code]true[/code], the file is read with big-endian [url=https://en.wikipedia.org/wiki/Endianness]endianness[/url]. If [code]false[/code], the file is read with little-endian endianness. If in doubt, leave this to [code]false[/code] as most files are written with little-endian endianness.
|
||||
[b]Note:[/b] [member big_endian] is only about the file format, not the CPU type. The CPU endianness doesn't affect the default endianness for files written.
|
||||
[b]Note:[/b] This is always reset to [code]false[/code] whenever you open the file. Therefore, you must set [member big_endian] [i]after[/i] opening the file, not before.
|
||||
[b]Note:[/b] This is always reset to system endianness, which is little-endian on all supported platforms, whenever you open the file. Therefore, you must set [member big_endian] [i]after[/i] opening the file, not before.
|
||||
</member>
|
||||
</members>
|
||||
<constants>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue