Skip to content

Commit

Permalink
Fixed: Progress not saving in exported binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
stmSi committed May 27, 2023
1 parent b4c00f6 commit bdea885
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Autoload/DisplaySettings.gd
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ signal renderer_changed(new_renderer: String)
signal resolution_try_changing(original: Vector2i, new: Vector2i)
signal max_fps_changed(fps: int)
func _ready() -> void:
Utils.check_and_create_user_dir()

# Settings Config Setup
config = ConfigFile.new()
var err = config.load(display_settings_file)
Expand Down
1 change: 1 addition & 0 deletions src/Autoload/GeneralSettings.gd
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ signal prevent_typing_pass_error_char_changed(prevent: bool)


func _ready() -> void:
Utils.check_and_create_user_dir()
# Settings Config Setup
config = ConfigFile.new()
var err = config.load(general_settings_path)
Expand Down
1 change: 1 addition & 0 deletions src/Autoload/SoundSettings.gd
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var config: ConfigFile = null


func _ready() -> void:
Utils.check_and_create_user_dir()
# Settings Config Setup
config = ConfigFile.new()
var err = config.load(settings_path)
Expand Down
1 change: 1 addition & 0 deletions src/Autoload/UserProfileManager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var corrected_chars_frequency = []


func _ready() -> void:
Utils.check_and_create_user_dir()
if not FileAccess.file_exists(profile_data_file):
save_file = ConfigFile.new()
# save Default data
Expand Down
12 changes: 12 additions & 0 deletions src/Autoload/Utils.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
extends Node

func _ready() -> void:
# Just in case.
check_and_create_user_dir()
pass

func check_and_create_user_dir():
var dir = DirAccess.open(OS.get_user_data_dir())
print("Checking User Dir: ", OS.get_user_data_dir())
if dir == null:
print("User Dir Not Found.")
print("Making: ", OS.get_user_data_dir())
dir.make_dir_recursive(OS.get_user_data_dir())

func randomize_packed_array(packed_array: PackedStringArray):
# PackedStringArray doesn't support shuffle()
Expand Down

0 comments on commit bdea885

Please sign in to comment.