Add noExtension flag to getFolderContent for cleaner Paths usage (#654)
* yeah
* Revert "yeah"
This reverts commit 5ab6ab8c7d.
* idk wtf happend
* Fixed Missing Curly Bracket
* hi
---------
Co-authored-by: Furo <furogaming9@gmail.com>
Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com>
This commit is contained in:
@@ -274,13 +274,13 @@ class Paths
|
||||
}
|
||||
return content;
|
||||
}
|
||||
static public function getFolderContent(key:String, addPath:Bool = false, source:AssetsLibraryList.AssetSource = BOTH):Array<String> {
|
||||
static public function getFolderContent(key:String, addPath:Bool = false, source:AssetsLibraryList.AssetSource = BOTH, noExtension:Bool = false):Array<String> {
|
||||
// designed to work both on windows and web
|
||||
if (!key.endsWith("/")) key += "/";
|
||||
var content = assetsTree.getFiles('assets/$key', source);
|
||||
if (addPath) {
|
||||
for(k=>e in content)
|
||||
content[k] = '$key$e';
|
||||
for (k => e in content) {
|
||||
if (noExtension) e = Path.withoutExtension(e);
|
||||
content[k] = addPath ? '$key$e' : e;
|
||||
}
|
||||
return content;
|
||||
/*
|
||||
@@ -363,4 +363,4 @@ class ScriptPathInfo {
|
||||
this.file = file;
|
||||
this.library = library;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user