summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-10-03 14:52:01 +0200
committerRémi Verschelde <rverschelde@gmail.com>2022-10-03 14:52:01 +0200
commit44dcd83290b80c46abec950c148fc443e3f8155d (patch)
tree3d8b2721fbb86a55671c9436a27cbf3a491549b3 /doc
parent7dea80d0822ec0dce9136474d534b6e7a16edddb (diff)
parentd196a07ea4d3365142af1286b380971987e3535a (diff)
Merge pull request #66768 from coppolaemilio/fileaccess-class-reference-update
Replacing deprecated File calls from the FileAccess class documentation
Diffstat (limited to 'doc')
-rw-r--r--doc/classes/FileAccess.xml10
1 files changed, 4 insertions, 6 deletions
diff --git a/doc/classes/FileAccess.xml b/doc/classes/FileAccess.xml
index f4ae70cf22..e52f897164 100644
--- a/doc/classes/FileAccess.xml
+++ b/doc/classes/FileAccess.xml
@@ -20,13 +20,13 @@
[csharp]
public void Save(string content)
{
- using var file = FileAccess.Open("user://save_game.dat", File.ModeFlags.Write);
+ using var file = FileAccess.Open("user://save_game.dat", FileAccess.ModeFlags.Write);
file.StoreString(content);
}
public string Load()
{
- using var file = FileAccess.Open("user://save_game.dat", File.ModeFlags.Read);
+ using var file = FileAccess.Open("user://save_game.dat", FileAccess.ModeFlags.Read);
string content = file.GetAsText();
return content;
}
@@ -316,8 +316,7 @@
return (unsigned + MAX_15B) % MAX_16B - MAX_15B
func _ready():
- var f = File.new()
- f.open("user://file.dat", File.WRITE_READ)
+ var f = FileAccess.open("user://file.dat", FileAccess.WRITE_READ)
f.store_16(-42) # This wraps around and stores 65494 (2^16 - 42).
f.store_16(121) # In bounds, will store 121.
f.seek(0) # Go back to start to read the stored value.
@@ -329,8 +328,7 @@
[csharp]
public override void _Ready()
{
- var f = new File();
- f.Open("user://file.dat", File.ModeFlags.WriteRead);
+ using var f = FileAccess.Open("user://file.dat", FileAccess.ModeFlags.WriteRead);
f.Store16(unchecked((ushort)-42)); // This wraps around and stores 65494 (2^16 - 42).
f.Store16(121); // In bounds, will store 121.
f.Seek(0); // Go back to start to read the stored value.