func get_file_paths_in_folder(folder_path: String) -> Array:
var file_paths := []
var dir := Directory.new()
dir.open(folder_path)
dir.list_dir_begin(true, true) # true, true params to skip hidden and navigational
while true:
var file := dir.get_next()
if file == "":
break
if !file.ends_with(".import"):
continue
file_paths.append(folder_path + file.replace(".import", ""))
dir.list_dir_end()
return file_paths
Godot is my first programming language I'm learning and haven't touched static typing at all. I've have to use this func in order to Godot to export to android with all my images I'm using.
My questions:
while
what's true? What is the while
method using to check if it's true?
list_dir_begin
in the Godot docs explains that method as "Initializes the stream used to list all files and directories". Can someone explain what this means in a coding sense
file_paths.append(folder_path + file.replace(".import", ""))
This line seems to delete the ".import" at the end of the import files, is this correct? Does this make them .png's again in Godot's eye's? Or is this forcing Godot to some how reference the actual images?
Thank you for your help. I'm still trying to figure this stuff out.