Native class "FileAccess" cannot be constructed as it is abstract

Godot Version


Hi everyone,

this is in my file-manager:

extends Node

const file_name = ""
const file_path = "user://" + file_name

func load_data():
	var file =
	if not file.file_exists(file_path):
		print_debug('file [%s] does not exist; creating' % file_path)

Switching from Godot 3.5.3 to 4.2.2, an error at exporting my project occurs:
Identifier "File" not declared in the current scope.
I know something changed by the current version and I see “FileAccess” in the docs… but changing File to FileAccess gives me the message: “Native class "FileAccess" cannot be constructed as it is abstract.

I’m at a loss here. Could this be solved without drastically change the existing code?

Use instead of


That’s it, thanks!

1 Like