diff --git a/scripts/globals/layout_config.gd b/scripts/globals/layout_config.gd index b99f0ca..2fdd171 100644 --- a/scripts/globals/layout_config.gd +++ b/scripts/globals/layout_config.gd @@ -27,7 +27,7 @@ var _config := ConfigFile.new() func _ready() -> void: _load_custom_layouts(CUSTOM_LAYOUTS_PATH) var err := _load_config() - if err != OK: + if err: _set_defaults() @@ -71,7 +71,7 @@ func _load_config() -> Error: print("\nloading layout config....") var err := _config.load(CONFIG_PATH) - if err != OK: + if err: push_error("failed to load layout config file: '%s'" % error_string(err)) print() return FAILED @@ -121,7 +121,7 @@ func _save_config() -> Error: var err := _config.save(CONFIG_PATH) - if err != OK: + if err: push_error("failed to save config file: '%s'" % error_string(err)) return err @@ -131,7 +131,7 @@ func _save_config() -> Error: func _load_custom_layouts(path: String) -> void: if not DirAccess.dir_exists_absolute(path): var dir_err := DirAccess.make_dir_absolute(path) - if dir_err != OK: + if dir_err: push_error( "error creating directory '%s': %s" % [path, error_string(dir_err)] ) @@ -140,7 +140,7 @@ func _load_custom_layouts(path: String) -> void: var file_err := DirAccess.copy_absolute( CUSTOM_LAYOUTS_README, path.path_join(CUSTOM_LAYOUTS_README.get_file()) ) - if file_err != OK: + if file_err: push_error( ( "error copying file '%s': %s" diff --git a/scripts/layouts/layout_custom.gd b/scripts/layouts/layout_custom.gd index 75d47ea..139ee95 100644 --- a/scripts/layouts/layout_custom.gd +++ b/scripts/layouts/layout_custom.gd @@ -49,7 +49,7 @@ func _load_json_file(path: String) -> Variant: var content := file.get_as_text() var json := JSON.new() var err := json.parse(content) - if err != OK: + if err: push_error( ( "%s: json parse error at line %s: %s" diff --git a/scripts/layouts/parser_qmk.gd b/scripts/layouts/parser_qmk.gd index 9b3828e..90b68a0 100644 --- a/scripts/layouts/parser_qmk.gd +++ b/scripts/layouts/parser_qmk.gd @@ -201,7 +201,7 @@ func _init(data: Dictionary, file_name: String) -> void: var data_keys := data[LAYOUTS][layout_name][LAYOUT] as Array var err := _get_keymap_keys(data_keys, file_name) - if err != OK: + if err: _has_errors = true return _rows = _deserialize_keys(data_keys)