mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-02 05:27:43 -05:00
Optimise loom configuration, saves 1.2 seconds in my testing. #319
This commit is contained in:
@@ -37,21 +37,14 @@ public class Checksum {
|
||||
private static final Logger log = Logging.getLogger(Checksum.class);
|
||||
|
||||
public static boolean equals(File file, String checksum) {
|
||||
if (file == null) {
|
||||
if (file == null || !file.exists()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
//noinspection deprecation
|
||||
HashCode hash = Files.asByteSource(file).hash(Hashing.sha1());
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
for (Byte hashBytes : hash.asBytes()) {
|
||||
builder.append(Integer.toString((hashBytes & 0xFF) + 0x100, 16).substring(1));
|
||||
}
|
||||
|
||||
log.debug("Checksum check: '" + builder.toString() + "' == '" + checksum + "'?");
|
||||
return builder.toString().equals(checksum);
|
||||
log.debug("Checksum check: '" + hash.toString() + "' == '" + checksum + "'?");
|
||||
return hash.toString().equals(checksum);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user