From 924425074f4ae0284406a70e1b06d16baf3b3dc6 Mon Sep 17 00:00:00 2001 From: keepcalm Date: Sat, 13 Oct 2012 19:12:06 +1100 Subject: [PATCH] Changed RelauchLibraryManager so that files with different paths on the same baseURL can be implemented in one ILibrarySet. --- .../mods/fml/relauncher/RelaunchLibraryManager.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/fml/common/cpw/mods/fml/relauncher/RelaunchLibraryManager.java b/fml/common/cpw/mods/fml/relauncher/RelaunchLibraryManager.java index 9ecf7da49..ead05fe1f 100644 --- a/fml/common/cpw/mods/fml/relauncher/RelaunchLibraryManager.java +++ b/fml/common/cpw/mods/fml/relauncher/RelaunchLibraryManager.java @@ -85,13 +85,15 @@ public class RelaunchLibraryManager { boolean download = false; String libName = lib.getLibraries()[i]; + File tmp = new File(libName); + String targFileName = tmp.getName(); String checksum = lib.getHashes()[i]; - File libFile = new File(libDir, libName); + File libFile = new File(libDir, targFileName); if (!libFile.exists()) { try { - downloadFile(libFile, lib.getRootURL(), checksum); + downloadFile(libFile, lib.getRootURL(), libName, checksum); download = true; } catch (Throwable e) @@ -414,11 +416,14 @@ public class RelaunchLibraryManager return coreModDir; } - private static void downloadFile(File libFile, String rootUrl, String hash) + private static void downloadFile(File libFile, String rootUrl,String realFilePath, String hash) { try { - URL libDownload = new URL(String.format(rootUrl,libFile.getName())); + //rootUrl.replace("%s", libFile.getPath()) + URL libDownload = new URL(String.format(rootUrl,realFilePath)); + System.out.println("Downloading file: " + libDownload.getHost() + libDownload.getPath()); + System.out.println("The libFile's path is " + libFile.getAbsolutePath()); String infoString = String.format("Downloading file %s", libDownload.toString()); downloadMonitor.updateProgressString(infoString); FMLRelaunchLog.info(infoString);