Closes #6790
This commit is contained in:
@@ -476,13 +476,7 @@ public class Mods implements Loadable{
|
|||||||
ModMeta meta = null;
|
ModMeta meta = null;
|
||||||
|
|
||||||
try{
|
try{
|
||||||
Fi zip = file.isDirectory() ? file : new ZipFi(file);
|
meta = findMeta(resolveRoot(file.isDirectory() ? file : new ZipFi(file)));
|
||||||
|
|
||||||
if(zip.list().length == 1 && zip.list()[0].isDirectory()){
|
|
||||||
zip = zip.list()[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
meta = findMeta(zip);
|
|
||||||
}catch(Throwable ignored){
|
}catch(Throwable ignored){
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -507,7 +501,7 @@ public class Mods implements Loadable{
|
|||||||
if(steam) mod.addSteamID(file.name());
|
if(steam) mod.addSteamID(file.name());
|
||||||
}catch(Throwable e){
|
}catch(Throwable e){
|
||||||
if(e instanceof ClassNotFoundException && e.getMessage().contains("mindustry.plugin.Plugin")){
|
if(e instanceof ClassNotFoundException && e.getMessage().contains("mindustry.plugin.Plugin")){
|
||||||
Log.info("Plugin '@' is outdated and needs to be ported to 6.0! Update its main class to inherit from 'mindustry.mod.Plugin'. See https://mindustrygame.github.io/wiki/modding/6-migrationv6/", file.name());
|
Log.warn("Plugin '@' is outdated and needs to be ported to v7! Update its main class to inherit from 'mindustry.mod.Plugin'.", file.name());
|
||||||
}else if(steam){
|
}else if(steam){
|
||||||
Log.err("Failed to load mod workshop file @. Skipping.", file);
|
Log.err("Failed to load mod workshop file @. Skipping.", file);
|
||||||
Log.err(e);
|
Log.err(e);
|
||||||
@@ -935,10 +929,10 @@ public class Mods implements Loadable{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Loads a mod file+meta, but does not add it to the list.
|
private Fi resolveRoot(Fi fi){
|
||||||
* Note that directories can be loaded as mods. */
|
if(OS.isMac && (!(fi instanceof ZipFi))) fi.child(".DS_Store").delete();
|
||||||
private LoadedMod loadMod(Fi sourceFile) throws Exception{
|
Fi[] files = fi.list();
|
||||||
return loadMod(sourceFile, false, true);
|
return files.length == 1 && files[0].isDirectory() ? files[0] : fi;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Loads a mod file+meta, but does not add it to the list.
|
/** Loads a mod file+meta, but does not add it to the list.
|
||||||
@@ -949,10 +943,7 @@ public class Mods implements Loadable{
|
|||||||
ZipFi rootZip = null;
|
ZipFi rootZip = null;
|
||||||
|
|
||||||
try{
|
try{
|
||||||
Fi zip = sourceFile.isDirectory() ? sourceFile : (rootZip = new ZipFi(sourceFile));
|
Fi zip = resolveRoot(sourceFile.isDirectory() ? sourceFile : (rootZip = new ZipFi(sourceFile)));
|
||||||
if(zip.list().length == 1 && zip.list()[0].isDirectory()){
|
|
||||||
zip = zip.list()[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
ModMeta meta = findMeta(zip);
|
ModMeta meta = findMeta(zip);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user