Workaround for https://github.com/MultiMC/Launcher/issues/4400
This commit is contained in:
parent
71ac68371b
commit
e6410e8c48
3 changed files with 21 additions and 10 deletions
|
@ -91,10 +91,5 @@ publishing {
|
||||||
tasks.publish.dependsOn build
|
tasks.publish.dependsOn build
|
||||||
|
|
||||||
static String getVersionSuffix() {
|
static String getVersionSuffix() {
|
||||||
if (System.getenv("IS_PUBLICATION") != null) {
|
return ""
|
||||||
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"
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
|
|
||||||
org.gradle.daemon = false
|
org.gradle.daemon = false
|
||||||
|
|
||||||
fw_version = 1.5.5
|
fw_version = mmc2
|
||||||
|
|
|
@ -179,14 +179,24 @@ public interface IFileDetector {
|
||||||
// Check all cached libraries.
|
// Check all cached libraries.
|
||||||
boolean checked = true;
|
boolean checked = true;
|
||||||
for (Map.Entry<String, Path> entry : libsMap.entrySet()) {
|
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) {
|
if (!checked) {
|
||||||
System.out.println("Missing: " + entry.getValue());
|
System.out.println("Missing: " + entry.getValue());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return checked;
|
return checked;
|
||||||
}
|
}
|
||||||
// Skip installing process if installer profile doesn't exist.
|
// Skip installing process if installer profile doesn't exist.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -198,7 +208,13 @@ public interface IFileDetector {
|
||||||
* @return True represents the file is ready.
|
* @return True represents the file is ready.
|
||||||
*/
|
*/
|
||||||
static boolean checkExtraFile(Path path, String sha1) {
|
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) {
|
static boolean isFile(Path path) {
|
||||||
|
|
Loading…
Reference in a new issue