瀏覽代碼

Merge pull request #7033 from Arnklit/import-plugin-fileaccess-change

docs: fix for File -> FileAccess change
Max Hilbrunner 2 年之前
父節點
當前提交
fe8b9e1476
共有 1 個文件被更改,包括 3 次插入4 次删除
  1. 3 4
      tutorials/plugins/editor/import_plugins.rst

+ 3 - 4
tutorials/plugins/editor/import_plugins.rst

@@ -294,10 +294,9 @@ method. Our sample code is a bit long, so let's split in a few parts:
 ::
 
     func _import(source_file, save_path, options, r_platform_variants, r_gen_files):
-        var file = File.new()
-        var err = file.open(source_file, File.READ)
-        if err != OK:
-            return err
+        var file = FileAccess.open(source_file, FileAccess.READ)
+        if file == null:
+            return FileAccess.get_open_error()
 
         var line = file.get_line()