GUI/InputRemapMenu demo fixed to work with Godot 4 stable (#875)

File class object replaced by the new FileAccess class in order to fix the demo for Godot 4 release
This commit is contained in:
InfiniteProductions 2023-03-08 18:06:57 +01:00 committed by GitHub
parent 185d0f4b05
commit 92c39e7f1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 5 deletions

View File

@ -16,11 +16,10 @@ func _ready() -> void:
func load_keymap() -> void:
var file := File.new()
if not file.file_exists(keymaps_path):
if not FileAccess.file_exists(keymaps_path):
save_keymap() # There is no save file yet, so let's create one.
return
file.open(keymaps_path, File.READ)
var file = FileAccess.open(keymaps_path, FileAccess.READ)
var temp_keymap = file.get_var(true) as Dictionary
file.close()
# We don't just replace the keymaps dictionary, because if you
@ -38,7 +37,6 @@ func load_keymap() -> void:
func save_keymap() -> void:
# For saving the keymap, we just save the entire dictionary as a var.
var file := File.new()
file.open(keymaps_path, File.WRITE)
var file := FileAccess.open(keymaps_path, FileAccess.WRITE)
file.store_var(keymaps, true)
file.close()