diff options
| author | Petr Mrázek <peterix@gmail.com> | 2022-01-02 00:05:00 +0100 |
|---|---|---|
| committer | Sefa Eyeoglu <contact@scrumplex.net> | 2023-08-06 14:39:22 +0200 |
| commit | bd030afd9fa071501207becd9287666ea2a44acb (patch) | |
| tree | b4534f63bf7f36fc331b689c0847619fee44ffbb | |
| parent | d7796062a4c9ff09207947d0a8a6b0a427715042 (diff) | |
| download | Project-Tick-bd030afd9fa071501207becd9287666ea2a44acb.tar.gz Project-Tick-bd030afd9fa071501207becd9287666ea2a44acb.zip | |
Workaround for MultiMC/Launcher#4400
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
| -rw-r--r-- | build.gradle | 7 | ||||
| -rw-r--r-- | src/main/java/io/github/zekerzhayard/forgewrapper/installer/detector/IFileDetector.java | 22 |
2 files changed, 20 insertions, 9 deletions
diff --git a/build.gradle b/build.gradle index 45e6dee5d7..a8af5dfa2a 100644 --- a/build.gradle +++ b/build.gradle @@ -91,10 +91,5 @@ publishing { tasks.publish.dependsOn build static String getVersionSuffix() { - if (System.getenv("IS_PUBLICATION") != null) { - return "" - } else if (System.getenv("GITHUB_RUN_NUMBER") != null && System.getenv("GITHUB_SHA") != null) { - return "-s." + System.getenv("GITHUB_RUN_NUMBER") + "-" + System.getenv("GITHUB_SHA").substring(0, 7) - } - return "-LOCAL" + return "" } diff --git a/src/main/java/io/github/zekerzhayard/forgewrapper/installer/detector/IFileDetector.java b/src/main/java/io/github/zekerzhayard/forgewrapper/installer/detector/IFileDetector.java index a007a7790a..f9aa328e5a 100644 --- a/src/main/java/io/github/zekerzhayard/forgewrapper/installer/detector/IFileDetector.java +++ b/src/main/java/io/github/zekerzhayard/forgewrapper/installer/detector/IFileDetector.java @@ -184,14 +184,24 @@ public interface IFileDetector { // Check all cached libraries. boolean checked = true; for (Map.Entry<String, Path> entry : libsMap.entrySet()) { - checked = checkExtraFile(entry.getValue(), hashMap.get(entry.getKey() + "_SHA")); + String sha1 = ""; + String entryKey = entry.getKey(); + /** + * NOTE: workaround for https://github.com/MultiMC/Launcher/issues/4400 + * We ignore the hash of the client file and instead just rely on it being 'correct, maybe' if it's present at all + */ + System.out.println("Checking: " + entryKey); + if(!entryKey.equals("PATCHED")) { + sha1 = hashMap.get(entryKey + "_SHA"); + } + checked = checkExtraFile(entry.getValue(), sha1); if (!checked) { System.out.println("Missing: " + entry.getValue()); break; } } return checked; - } + } // Skip installing process if installer profile doesn't exist. return true; } @@ -203,7 +213,13 @@ public interface IFileDetector { * @return True represents the file is ready. */ static boolean checkExtraFile(Path path, String sha1) { - return sha1 == null || sha1.equals("") || (isFile(path) && sha1.toLowerCase(Locale.ENGLISH).equals(getFileSHA1(path))); + if (!isFile(path)) { + return false; + } + if(sha1 == null || sha1.equals("")) { + return true; + } + return sha1.toLowerCase(Locale.ENGLISH).equals(getFileSHA1(path)); } static boolean isFile(Path path) { |
