Created
October 16, 2021 17:00
-
-
Save DaelonSuzuka/da4a81ef1ba03fdc358708c84890d589 to your computer and use it in GitHub Desktop.
godotscript filesystem helpers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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