Skip to content

Commit

Permalink
GUI/InputRemapMenu demo fixed to work with Godot 4 stable (#875)
Browse files Browse the repository at this point in the history
File class object replaced by the new FileAccess class in order to fix the demo for Godot 4 release
  • Loading branch information
InfiniteProductions authored Mar 8, 2023
1 parent 185d0f4 commit 92c39e7
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions gui/input_mapping/KeyPersistence.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()

0 comments on commit 92c39e7

Please sign in to comment.