Remove warnings in the DemoPicker scene

Also turned off the setting for discarded return value warnings as it triggers
for many calls, including to built-in functions.
This commit is contained in:
Nathan Lovato 2020-02-11 13:15:29 -06:00
parent 692176be8e
commit 77f90b0c74
3 changed files with 13 additions and 7 deletions

View File

@ -2,6 +2,7 @@ class_name DemoPickerUI
extends Control extends Control
# warning-ignore:unused_signal
signal demo_requested signal demo_requested
var demo_path := "" setget set_demo_path var demo_path := "" setget set_demo_path

View File

@ -25,6 +25,7 @@ func populate(demos: PoolStringArray) -> void:
func sentencify(line: String) -> String: func sentencify(line: String) -> String:
var regex := RegEx.new() var regex := RegEx.new()
# warning-ignore:return_value_discarded
regex.compile("[A-Z]") regex.compile("[A-Z]")
line = line.split(".", true, 1)[0] line = line.split(".", true, 1)[0]
@ -33,31 +34,31 @@ func sentencify(line: String) -> String:
func _find_files(dirpath := "", patterns := PoolStringArray(), is_recursive := false, do_skip_hidden := true) -> PoolStringArray: func _find_files(dirpath := "", patterns := PoolStringArray(), is_recursive := false, do_skip_hidden := true) -> PoolStringArray:
var file_paths: = PoolStringArray() var paths: = PoolStringArray()
var directory: = Directory.new() var directory: = Directory.new()
if not directory.dir_exists(dirpath): if not directory.dir_exists(dirpath):
printerr("The directory does not exist: %s" % dirpath) printerr("The directory does not exist: %s" % dirpath)
return file_paths return paths
if not directory.open(dirpath) == OK: if not directory.open(dirpath) == OK:
printerr("Could not open the following dirpath: %s" % dirpath) printerr("Could not open the following dirpath: %s" % dirpath)
return file_paths return paths
# warning-ignore:return_value_discarded
directory.list_dir_begin(true, do_skip_hidden) directory.list_dir_begin(true, do_skip_hidden)
var file_name: = directory.get_next() var file_name: = directory.get_next()
var subdirectories: = PoolStringArray()
while file_name != "": while file_name != "":
if directory.current_is_dir() and is_recursive: if directory.current_is_dir() and is_recursive:
var subdirectory: = dirpath.plus_file(file_name) var subdirectory: = dirpath.plus_file(file_name)
file_paths.append_array(_find_files(subdirectory, patterns, is_recursive)) paths.append_array(_find_files(subdirectory, patterns, is_recursive))
else: else:
for pattern in patterns: for pattern in patterns:
if file_name.match(pattern): if file_name.match(pattern):
file_paths.append(dirpath.plus_file(file_name)) paths.append(dirpath.plus_file(file_name))
file_name = directory.get_next() file_name = directory.get_next()
directory.list_dir_end() directory.list_dir_end()
return file_paths return paths
func _on_item_selected(index: int) -> void: func _on_item_selected(index: int) -> void:

View File

@ -198,6 +198,10 @@ config/name="SteeringToolkit"
run/main_scene="res://demos/DemoSelector.tscn" run/main_scene="res://demos/DemoSelector.tscn"
config/icon="res://icon.png" config/icon="res://icon.png"
[debug]
gdscript/warnings/return_value_discarded=false
[display] [display]
window/size/width=1920 window/size/width=1920