Skip to content

Instantly share code, notes, and snippets.

@DaelonSuzuka
Created October 16, 2021 17:00
Show Gist options
  • Save DaelonSuzuka/da4a81ef1ba03fdc358708c84890d589 to your computer and use it in GitHub Desktop.
Save DaelonSuzuka/da4a81ef1ba03fdc358708c84890d589 to your computer and use it in GitHub Desktop.
godotscript filesystem helpers
static func get_dir_files(path: String) -> PoolStringArray:
var arr: PoolStringArray
var dir := Directory.new()
dir.open(path)
if dir.file_exists(path):
arr.append(path)
else:
dir.list_dir_begin(true, true)
while(true):
var subpath := dir.get_next()
if subpath.empty():
break
arr += get_dir_files(path.plus_file(subpath))
return arr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment