Fix library path and soft fail when repository root is not found.
This commit is contained in:
parent
68ce80dad4
commit
34f4381e0c
2 changed files with 9 additions and 5 deletions
|
@ -133,13 +133,13 @@ public class LibraryManager
|
|||
apache = apache.getParentFile(); //Get to a directory, this *should* always be the case...
|
||||
apache = apache.getParentFile(); //Skip the version folder. In case we ever update the version, I don't want to edit this code again.
|
||||
|
||||
if (!apache.getAbsolutePath().toLowerCase(Locale.ENGLISH).replace(File.separatorChar, '/').endsWith("/org/apache/maven/maven/"))
|
||||
if (!apache.getAbsolutePath().toLowerCase(Locale.ENGLISH).replace(File.separatorChar, '/').endsWith("/org/apache/maven/maven-artifact/"))
|
||||
{
|
||||
FMLLog.log.error("Apache Maven library folder was not in the format expected: {}. Using default libraries directory.", new File(source.getLocation().toURI()));
|
||||
return new File(minecraftHome, "libraries");
|
||||
}
|
||||
// maven /maven /apache /org /libraries
|
||||
return apache.getParentFile().getParentFile().getParentFile().getParentFile();
|
||||
// maven-artifact /maven /apache /org /libraries
|
||||
return apache .getParentFile().getParentFile().getParentFile().getParentFile();
|
||||
}
|
||||
catch (URISyntaxException e)
|
||||
{
|
||||
|
|
|
@ -140,7 +140,11 @@ public class ModList
|
|||
{
|
||||
try
|
||||
{
|
||||
temp = Repository.create(getFile(mcdir, this.mod_list.repositoryRoot));
|
||||
File repoFile = getFile(mcdir, this.mod_list.repositoryRoot);
|
||||
if (repoFile != null)
|
||||
{
|
||||
temp = Repository.create(repoFile);
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
@ -205,7 +209,7 @@ public class ModList
|
|||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
FMLLog.log.info(FMLLog.log.getMessageFactory().newMessage("Unable to canonicalize path {} relative to {}", path, root.getAbsolutePath()), ioe);
|
||||
FMLLog.log.info(FMLLog.log.getMessageFactory().newMessage("Unable to canonicalize path {} relative to {}", path, root.getAbsolutePath()));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue