This is better

This commit is contained in:
CocoTheOwner 2021-08-08 11:56:12 +02:00
parent ec75e911bd
commit 81184d77fe

View File

@ -155,15 +155,19 @@ public class IrisCompat {
String defa = new JSONObject(new Gson().toJson(def)).toString(4);
J.attemptAsync(() -> IO.writeAll(new File(f.getParentFile(), "compat.default.json"), defa));
if (!f.exists()) {
J.a(() -> {
try {
IO.writeAll(f, defa);
} catch (IOException e) {
Iris.error("Failed to write to compat file");
Iris.reportError(e);
}
}
});
} else {
// If the file doesn't exist, no additional mappings are present outside default
// so we shouldn't try getting them
try {
IrisCompat rea = new Gson().fromJson(IO.readAll(f), IrisCompat.class);
@ -178,6 +182,7 @@ public class IrisCompat {
e.printStackTrace();
Iris.reportError(e);
}
}
return def;
}