Merge pull request #366 from altrisi/patch-1
Don't create an empty directory with no modcore available
This commit is contained in:
@@ -122,6 +122,11 @@ public class ModCoreInstaller {
|
|||||||
|
|
||||||
public static int initialize(File gameDir, String minecraftVersion) {
|
public static int initialize(File gameDir, String minecraftVersion) {
|
||||||
if (isInitalized()) return -1;
|
if (isInitalized()) return -1;
|
||||||
|
JsonHolder jsonHolder = fetchJSON(VERSION_URL);
|
||||||
|
if (!jsonHolder.has(minecraftVersion)) {
|
||||||
|
System.out.println("No ModCore target for " + minecraftVersion + ". This in fine, unless you're specifically looking for ModCore.");
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
dataDir = new File(gameDir, "modcore");
|
dataDir = new File(gameDir, "modcore");
|
||||||
if (!dataDir.exists()) {
|
if (!dataDir.exists()) {
|
||||||
if (!dataDir.mkdirs()) {
|
if (!dataDir.mkdirs()) {
|
||||||
@@ -129,11 +134,6 @@ public class ModCoreInstaller {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
JsonHolder jsonHolder = fetchJSON(VERSION_URL);
|
|
||||||
if (!jsonHolder.has(minecraftVersion)) {
|
|
||||||
System.out.println("No ModCore target for " + minecraftVersion + ". This in fine, unless you're specifically looking for ModCore.");
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
String latestRemote = jsonHolder.optString(minecraftVersion);
|
String latestRemote = jsonHolder.optString(minecraftVersion);
|
||||||
boolean failed = jsonHolder.getKeys().size() == 0 || (jsonHolder.has("success") && !jsonHolder.optBoolean("success"));
|
boolean failed = jsonHolder.getKeys().size() == 0 || (jsonHolder.has("success") && !jsonHolder.optBoolean("success"));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user