Browse Source

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
InfiniteProductions 2 years ago
parent
commit
92c39e7f1c
1 changed files with 3 additions and 5 deletions
  1. 3 5
      gui/input_mapping/KeyPersistence.gd

+ 3 - 5
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()