Forge will now load extra mods from mods/mod_list.json and mods/mc_version/mod_list.json.

As defined by the same json spec as --modListFile.
And now if repositoryRoot is prefixed with absolute: the path will NOT be relative to the MC directory.
This commit is contained in:
LexManos 2016-06-30 00:16:40 -07:00
parent 6ad65f4e64
commit 72f7c0be1f
1 changed files with 17 additions and 1 deletions

View File

@ -62,12 +62,28 @@ public class ModListHelper {
tryAddFile(modFile, null, modFile);
}
}
String[] extras = new String[]
{
"mods/mod_list.json",
"mods/" + FMLInjectionData.mccversion + "/mod_list.json"
};
for (String extra : extras)
{
if ((new File(mcDirectory, extra)).exists())
parseListFile(extra);
}
}
private static void parseListFile(String listFile) {
File f;
try
{
f = new File(mcDirectory, listFile).getCanonicalFile();
if (listFile.startsWith("absolute:"))
f = new File(listFile.substring(9)).getCanonicalFile();
else
f = new File(mcDirectory, listFile).getCanonicalFile();
} catch (IOException e2)
{
FMLRelaunchLog.log(Level.INFO, e2, "Unable to canonicalize path %s relative to %s", listFile, mcDirectory.getAbsolutePath());