From 34f4381e0ca6ae87c00034e7f5757e173b3dd02e Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 17 Apr 2018 19:24:43 -0700 Subject: [PATCH] Fix library path and soft fail when repository root is not found. --- .../fml/relauncher/libraries/LibraryManager.java | 6 +++--- .../minecraftforge/fml/relauncher/libraries/ModList.java | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/relauncher/libraries/LibraryManager.java b/src/main/java/net/minecraftforge/fml/relauncher/libraries/LibraryManager.java index 783442d89b..c35665e07f 100644 --- a/src/main/java/net/minecraftforge/fml/relauncher/libraries/LibraryManager.java +++ b/src/main/java/net/minecraftforge/fml/relauncher/libraries/LibraryManager.java @@ -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) { diff --git a/src/main/java/net/minecraftforge/fml/relauncher/libraries/ModList.java b/src/main/java/net/minecraftforge/fml/relauncher/libraries/ModList.java index 3f320d189b..2c4cecbfca 100644 --- a/src/main/java/net/minecraftforge/fml/relauncher/libraries/ModList.java +++ b/src/main/java/net/minecraftforge/fml/relauncher/libraries/ModList.java @@ -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; }