replace newlines in printerr with empty prints
This commit is contained in:
parent
02f112f168
commit
263e06a944
@ -83,7 +83,8 @@ func _load_config() -> Error:
|
||||
return FAILED
|
||||
|
||||
if err != OK:
|
||||
printerr("failed to load layout config file: '%s'\n" % err)
|
||||
printerr("failed to load layout config file: '%s'" % err)
|
||||
print()
|
||||
return FAILED
|
||||
|
||||
var layout_name := ""
|
||||
@ -142,7 +143,8 @@ 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:
|
||||
printerr("error creating directory '%s': %s\n" % [path, dir_err])
|
||||
printerr("error creating directory '%s': %s" % [path, dir_err])
|
||||
print()
|
||||
return
|
||||
var file_err := DirAccess.copy_absolute(
|
||||
CUSTOM_LAYOUTS_README, path.path_join(CUSTOM_LAYOUTS_README.get_file())
|
||||
@ -154,9 +156,10 @@ func _load_custom_layouts(path: String) -> void:
|
||||
if not dir:
|
||||
var err := DirAccess.get_open_error()
|
||||
if err == ERR_FILE_NOT_FOUND:
|
||||
printerr("directory not found '%s'\n" % path)
|
||||
printerr("directory not found '%s'" % path)
|
||||
else:
|
||||
printerr("error opening directory '%s': %s\n" % [path, err])
|
||||
printerr("error opening directory '%s': %s" % [path, err])
|
||||
print()
|
||||
return
|
||||
|
||||
var files := dir.get_files()
|
||||
@ -168,15 +171,14 @@ func _load_custom_layouts(path: String) -> void:
|
||||
if file_name.get_extension().to_lower() != "json":
|
||||
continue
|
||||
var layout := LayoutCustom.new(path.path_join(file_name))
|
||||
if layout.has_errors or layout.failed:
|
||||
print()
|
||||
if layout.failed:
|
||||
continue
|
||||
if layouts.has(layout.get_name()):
|
||||
printerr(
|
||||
(
|
||||
"layout '%s' already exists and will be replaced by the new one\n"
|
||||
"layout '%s' already exists and will be replaced by the new one"
|
||||
% [layout.get_name()]
|
||||
)
|
||||
)
|
||||
print()
|
||||
layouts[layout.get_name()] = layout
|
||||
|
||||
@ -24,7 +24,7 @@ enum {
|
||||
NUB,
|
||||
}
|
||||
|
||||
var physical_keycode: Key
|
||||
var physical_keycode: Key = KEY_NONE
|
||||
var location: KeyLocation = KEY_LOCATION_UNSPECIFIED
|
||||
|
||||
var width: float = 1
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
class_name LayoutCustom extends AbstractLayout
|
||||
|
||||
var failed: bool = false
|
||||
var has_errors: bool = false
|
||||
var failed: bool
|
||||
|
||||
var _name: String
|
||||
var _rows: Array[Array]
|
||||
var _file_name: String
|
||||
var _has_errors: bool
|
||||
|
||||
|
||||
func _init(path: String) -> void:
|
||||
@ -16,14 +16,18 @@ func _init(path: String) -> void:
|
||||
if not data:
|
||||
failed = true
|
||||
printerr("%s: COULD NOT PARSE CUSTOM LAYOUT JSON" % _file_name)
|
||||
print()
|
||||
return
|
||||
|
||||
var layout_rows := _deserialize(data, _file_name)
|
||||
if not layout_rows:
|
||||
failed = true
|
||||
printerr("%s: COULD NOT DESERIALIZE CUSTOM LAYOUT" % _file_name)
|
||||
print()
|
||||
return
|
||||
|
||||
if _has_errors:
|
||||
print()
|
||||
_rows = layout_rows
|
||||
|
||||
|
||||
@ -75,5 +79,5 @@ func _deserialize(data: Variant, path: String) -> Array[Array]:
|
||||
return []
|
||||
if parser.get_name() != "":
|
||||
_name = parser.get_name()
|
||||
has_errors = parser.has_errors()
|
||||
_has_errors = parser.has_errors()
|
||||
return parser.get_rows()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user