From 92c39e7f1c427359785a41c4b7322a125594a879 Mon Sep 17 00:00:00 2001 From: InfiniteProductions Date: Wed, 8 Mar 2023 18:06:57 +0100 Subject: [PATCH] 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 --- gui/input_mapping/KeyPersistence.gd | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/gui/input_mapping/KeyPersistence.gd b/gui/input_mapping/KeyPersistence.gd index 74da9778..355d04e3 100644 --- a/gui/input_mapping/KeyPersistence.gd +++ b/gui/input_mapping/KeyPersistence.gd @@ -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()