Don't duplicate default asset library

This commit is contained in:
Ralty
2025-08-04 18:08:21 +07:00
parent d90f068e67
commit 38997b4765
5 changed files with 44 additions and 39 deletions
+17 -9
View File
@@ -473,14 +473,22 @@ class FreeplaySonglist {
public function new() {}
public function getSongsFromSource(source:funkin.backend.assets.AssetSource, useTxt:Bool = true) {
var oldPath = Paths.txt("freeplaySonglist");
var newPath = Paths.txt("config/freeplaySonglist");
var path:String = useTxt && !Paths.assetsTree.existsSpecific(newPath, "TEXT", source) && Paths.assetsTree.existsSpecific(oldPath, "TEXT", source) ? {
Logs.warn("data/freeplaySonglist.txt is deprecated and will be removed in the future. Please move the file to data/config/", DARKYELLOW, "FreeplaySonglist");
oldPath;
} : newPath;
var songsFound:Array<String> = useTxt && Paths.assetsTree.existsSpecific(path, "TEXT", source) ? CoolUtil.coolTextFile(path): Paths.getFolderDirectories("songs", false, source);
var songsFound:Array<String> = null;
if (useTxt) {
var oldPath = Paths.txt('freeplaySonglist');
var newPath = Paths.txt('config/freeplaySonglist');
trace(oldPath, newPath, source);
if (Paths.assetsTree.existsSpecific(newPath, "TEXT", source)) {
trace('new');
songsFound = CoolUtil.coolTextFile(newPath);
}
else if (Paths.assetsTree.existsSpecific(oldPath, "TEXT", source)) {
trace('old');
Logs.warn("data/freeplaySonglist.txt is deprecated and will be removed in the future. Please move the file to data/config/", DARKYELLOW, "FreeplaySonglist");
songsFound = CoolUtil.coolTextFile(oldPath);
}
}
if (songsFound == null) songsFound = Paths.getFolderDirectories("songs", false, source);
if (songsFound.length > 0) {
for (s in songsFound) songs.push(Chart.loadChartMeta(s, Flags.DEFAULT_DIFFICULTY, source == MODS));
return false;
@@ -499,7 +507,7 @@ class FreeplaySonglist {
songList.getSongsFromSource(SOURCE, useTxt);
songList.getSongsFromSource(MODS, useTxt);
default /*case 'override'*/:
if (songList.getSongsFromSource(MODS, useTxt))
if (!songList.getSongsFromSource(MODS, useTxt))
songList.getSongsFromSource(SOURCE, useTxt);
}