bugfix for loading deleted mods + safe saves

This commit is contained in:
⍚~Nex
2024-03-17 18:00:18 +01:00
parent c3691c8f08
commit 3de8fcc804
10 changed files with 56 additions and 49 deletions
+21 -2
View File
@@ -51,10 +51,11 @@ class ModsFolder {
*/
private static var __firstTime:Bool = true;
/**
* Initialises `mods` folder by adding callbacks and such.
* Initialises `mods` folder.
*/
public static function init() {
if(!getModsList().contains(Options.lastLoadedMod))
Options.lastLoadedMod = null;
}
/**
@@ -89,6 +90,24 @@ class ModsFolder {
#end
}
public static function getModsList():Array<String> {
var mods:Array<String> = [];
#if MOD_SUPPORT
for(modFolder in FileSystem.readDirectory(modsPath)) {
if (FileSystem.isDirectory('${modsPath}${modFolder}')) {
mods.push(modFolder);
} else {
var ext = Path.extension(modFolder).toLowerCase();
switch(ext) {
case 'zip':
// is a zip mod!!
mods.push(Path.withoutExtension(modFolder));
}
}
}
#end
return mods;
}
public static function getLoadedMods():Array<String> {
var libs = [];
for (i in Paths.assetsTree.libraries) {