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
|
return FAILED
|
||||||
|
|
||||||
if err != OK:
|
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
|
return FAILED
|
||||||
|
|
||||||
var layout_name := ""
|
var layout_name := ""
|
||||||
@ -142,7 +143,8 @@ func _load_custom_layouts(path: String) -> void:
|
|||||||
if not DirAccess.dir_exists_absolute(path):
|
if not DirAccess.dir_exists_absolute(path):
|
||||||
var dir_err := DirAccess.make_dir_absolute(path)
|
var dir_err := DirAccess.make_dir_absolute(path)
|
||||||
if dir_err != OK:
|
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
|
return
|
||||||
var file_err := DirAccess.copy_absolute(
|
var file_err := DirAccess.copy_absolute(
|
||||||
CUSTOM_LAYOUTS_README, path.path_join(CUSTOM_LAYOUTS_README.get_file())
|
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:
|
if not dir:
|
||||||
var err := DirAccess.get_open_error()
|
var err := DirAccess.get_open_error()
|
||||||
if err == ERR_FILE_NOT_FOUND:
|
if err == ERR_FILE_NOT_FOUND:
|
||||||
printerr("directory not found '%s'\n" % path)
|
printerr("directory not found '%s'" % path)
|
||||||
else:
|
else:
|
||||||
printerr("error opening directory '%s': %s\n" % [path, err])
|
printerr("error opening directory '%s': %s" % [path, err])
|
||||||
|
print()
|
||||||
return
|
return
|
||||||
|
|
||||||
var files := dir.get_files()
|
var files := dir.get_files()
|
||||||
@ -168,15 +171,14 @@ func _load_custom_layouts(path: String) -> void:
|
|||||||
if file_name.get_extension().to_lower() != "json":
|
if file_name.get_extension().to_lower() != "json":
|
||||||
continue
|
continue
|
||||||
var layout := LayoutCustom.new(path.path_join(file_name))
|
var layout := LayoutCustom.new(path.path_join(file_name))
|
||||||
if layout.has_errors or layout.failed:
|
|
||||||
print()
|
|
||||||
if layout.failed:
|
if layout.failed:
|
||||||
continue
|
continue
|
||||||
if layouts.has(layout.get_name()):
|
if layouts.has(layout.get_name()):
|
||||||
printerr(
|
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()]
|
% [layout.get_name()]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
print()
|
||||||
layouts[layout.get_name()] = layout
|
layouts[layout.get_name()] = layout
|
||||||
|
|||||||
@ -24,7 +24,7 @@ enum {
|
|||||||
NUB,
|
NUB,
|
||||||
}
|
}
|
||||||
|
|
||||||
var physical_keycode: Key
|
var physical_keycode: Key = KEY_NONE
|
||||||
var location: KeyLocation = KEY_LOCATION_UNSPECIFIED
|
var location: KeyLocation = KEY_LOCATION_UNSPECIFIED
|
||||||
|
|
||||||
var width: float = 1
|
var width: float = 1
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
class_name LayoutCustom extends AbstractLayout
|
class_name LayoutCustom extends AbstractLayout
|
||||||
|
|
||||||
var failed: bool = false
|
var failed: bool
|
||||||
var has_errors: bool = false
|
|
||||||
|
|
||||||
var _name: String
|
var _name: String
|
||||||
var _rows: Array[Array]
|
var _rows: Array[Array]
|
||||||
var _file_name: String
|
var _file_name: String
|
||||||
|
var _has_errors: bool
|
||||||
|
|
||||||
|
|
||||||
func _init(path: String) -> void:
|
func _init(path: String) -> void:
|
||||||
@ -16,14 +16,18 @@ func _init(path: String) -> void:
|
|||||||
if not data:
|
if not data:
|
||||||
failed = true
|
failed = true
|
||||||
printerr("%s: COULD NOT PARSE CUSTOM LAYOUT JSON" % _file_name)
|
printerr("%s: COULD NOT PARSE CUSTOM LAYOUT JSON" % _file_name)
|
||||||
|
print()
|
||||||
return
|
return
|
||||||
|
|
||||||
var layout_rows := _deserialize(data, _file_name)
|
var layout_rows := _deserialize(data, _file_name)
|
||||||
if not layout_rows:
|
if not layout_rows:
|
||||||
failed = true
|
failed = true
|
||||||
printerr("%s: COULD NOT DESERIALIZE CUSTOM LAYOUT" % _file_name)
|
printerr("%s: COULD NOT DESERIALIZE CUSTOM LAYOUT" % _file_name)
|
||||||
|
print()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if _has_errors:
|
||||||
|
print()
|
||||||
_rows = layout_rows
|
_rows = layout_rows
|
||||||
|
|
||||||
|
|
||||||
@ -75,5 +79,5 @@ func _deserialize(data: Variant, path: String) -> Array[Array]:
|
|||||||
return []
|
return []
|
||||||
if parser.get_name() != "":
|
if parser.get_name() != "":
|
||||||
_name = parser.get_name()
|
_name = parser.get_name()
|
||||||
has_errors = parser.has_errors()
|
_has_errors = parser.has_errors()
|
||||||
return parser.get_rows()
|
return parser.get_rows()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user