summaryrefslogtreecommitdiff
path: root/doc/classes
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-01-30 17:34:56 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-01-30 17:34:56 +0100
commita5cefef2d871138ab2e3d2a55c7b42a7b178de0e (patch)
tree54379ccfa7eb5822eaea28b80e2205f4b2c12e8d /doc/classes
parent19c2c54ee52c6de1351792778cfa03afa9f2ecb8 (diff)
parent4a4adec33db7a928418ade06cd54823fd541b786 (diff)
Merge pull request #72381 from yedpodtrzitko/yed/update-fileaccess-docs
docs: replace `File` with `FileAccess`
Diffstat (limited to 'doc/classes')
-rw-r--r--doc/classes/EditorImportPlugin.xml4
-rw-r--r--doc/classes/EditorTranslationParserPlugin.xml3
-rw-r--r--doc/classes/HashingContext.xml11
3 files changed, 8 insertions, 10 deletions
diff --git a/doc/classes/EditorImportPlugin.xml b/doc/classes/EditorImportPlugin.xml
index c395815117..ec9efcc9c4 100644
--- a/doc/classes/EditorImportPlugin.xml
+++ b/doc/classes/EditorImportPlugin.xml
@@ -37,8 +37,8 @@
return [{"name": "my_option", "default_value": false}]
func _import(source_file, save_path, options, platform_variants, gen_files):
- var file = File.new()
- if file.open(source_file, File.READ) != OK:
+ var file = FileAccess.open(source_file, FileAccess.READ)
+ if file == null:
return FAILED
var mesh = ArrayMesh.new()
# Fill the Mesh with data read in "file", left as an exercise to the reader.
diff --git a/doc/classes/EditorTranslationParserPlugin.xml b/doc/classes/EditorTranslationParserPlugin.xml
index df10c645ef..89746363d8 100644
--- a/doc/classes/EditorTranslationParserPlugin.xml
+++ b/doc/classes/EditorTranslationParserPlugin.xml
@@ -15,8 +15,7 @@
extends EditorTranslationParserPlugin
func _parse_file(path, msgids, msgids_context_plural):
- var file = File.new()
- file.open(path, File.READ)
+ var file = FileAccess.open(path, FileAccess.READ)
var text = file.get_as_text()
var split_strs = text.split(",", false)
for s in split_strs:
diff --git a/doc/classes/HashingContext.xml b/doc/classes/HashingContext.xml
index 6e3092e618..7c2be6f817 100644
--- a/doc/classes/HashingContext.xml
+++ b/doc/classes/HashingContext.xml
@@ -11,15 +11,14 @@
const CHUNK_SIZE = 102
func hash_file(path):
- var ctx = HashingContext.new()
- var file = File.new()
- # Start a SHA-256 context.
- ctx.start(HashingContext.HASH_SHA256)
# Check that file exists.
- if not file.file_exists(path):
+ if not FileAccess.file_exists(path):
return
+ # Start a SHA-256 context.
+ var ctx = HashingContext.new()
+ ctx.start(HashingContext.HASH_SHA256)
# Open the file to hash.
- file.open(path, File.READ)
+ var file = FileAccess.open(path, FileAccess.READ)
# Update the context after reading each chunk.
while not file.eof_reached():
ctx.update(file.get_buffer(CHUNK_SIZE))