Skip to content

Commit 9d13923

Browse files
HeroEyadFuroYTNexIsDumb
authored
Add noExtension flag to getFolderContent for cleaner Paths usage (#654)
* yeah * Revert "yeah" This reverts commit 5ab6ab8. * idk wtf happend * Fixed Missing Curly Bracket * hi --------- Co-authored-by: Furo <[email protected]> Co-authored-by: ⍚~Nex <[email protected]>
1 parent 7a39947 commit 9d13923

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

source/funkin/backend/assets/Paths.hx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,13 +274,13 @@ class Paths
274274
}
275275
return content;
276276
}
277-
static public function getFolderContent(key:String, addPath:Bool = false, source:AssetsLibraryList.AssetSource = BOTH):Array<String> {
277+
static public function getFolderContent(key:String, addPath:Bool = false, source:AssetsLibraryList.AssetSource = BOTH, noExtension:Bool = false):Array<String> {
278278
// designed to work both on windows and web
279279
if (!key.endsWith("/")) key += "/";
280280
var content = assetsTree.getFiles('assets/$key', source);
281-
if (addPath) {
282-
for(k=>e in content)
283-
content[k] = '$key$e';
281+
for (k => e in content) {
282+
if (noExtension) e = Path.withoutExtension(e);
283+
content[k] = addPath ? '$key$e' : e;
284284
}
285285
return content;
286286
/*
@@ -363,4 +363,4 @@ class ScriptPathInfo {
363363
this.file = file;
364364
this.library = library;
365365
}
366-
}
366+
}

0 commit comments

Comments
 (0)