get asset fix

This commit is contained in:
⍚~Nex
2024-02-05 17:28:07 +01:00
parent e9e7daafe0
commit 6e7abd1542
2 changed files with 9 additions and 10 deletions
@@ -100,15 +100,11 @@ class AssetsLibraryList extends AssetLibrary {
public function getSpecificAsset(id:String, type:String, source:AssetSource = BOTH, ?avoidRoot:Bool = false):Dynamic {
try {
var fileFromAssets:Bool = id.startsWith("assets/");
if (!fileFromAssets) {
if (!id.startsWith("assets/")) {
var ass = getSpecificAsset('assets/$id', type, source);
if (ass != null)
return ass;
}
if (fileFromAssets) {
} else {
for (lib in assetsLibs) {
if (shouldSkipLib(libraries.indexOf(lib), source)) continue;
@@ -116,7 +112,9 @@ class AssetsLibraryList extends AssetLibrary {
if (asset != null)
return asset;
}
} else if (!avoidRoot) {
}
if (!avoidRoot) {
for (lib in rootLibs) {
if (shouldSkipLib(libraries.indexOf(lib), source)) continue;
@@ -182,7 +180,7 @@ class AssetsLibraryList extends AssetLibrary {
if (finalLib is IModsAssetLibrary)
assetsLibs.insert(0, finalLib);
else
else
rootLibs.insert(0, finalLib);
return lib;
}
+3 -2
View File
@@ -20,11 +20,12 @@ class CreditsMain extends TreeMenu {
add(bg);
var selectables:Array<OptionType> = [];
var xmlPath = Paths.xml('config/credits');
for(source in [funkin.backend.assets.AssetsLibraryList.AssetSource.SOURCE, funkin.backend.assets.AssetsLibraryList.AssetSource.MODS]) {
if (Paths.assetsTree.existsSpecific(Paths.xml('config/credits'), "TEXT", source)) {
if (Paths.assetsTree.existsSpecific(xmlPath, "TEXT", source)) {
var access:Access = null;
try {
access = new Access(Xml.parse(Paths.assetsTree.getSpecificAsset(Paths.xml('config/credits'), "TEXT", source)));
access = new Access(Xml.parse(Paths.assetsTree.getSpecificAsset(xmlPath, "TEXT", source)));
} catch(e) {
Logs.trace('Error while parsing credits.xml: ${Std.string(e)}', ERROR);
}