This commit is contained in:
Petr Mrázek 2022-01-02 00:05:00 +01:00
parent 71ac68371b
commit e6410e8c48
3 changed files with 21 additions and 10 deletions

View file

@ -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"
}

View file

@ -1,4 +1,4 @@
org.gradle.daemon = false
fw_version = 1.5.5
fw_version = mmc2

View file

@ -179,7 +179,17 @@ 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;
@ -198,7 +208,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) {