mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-03 05:57:42 -05:00
Fix local file mod dependencies (#430)
Signed-off-by: shedaniel <daniel@shedaniel.me>
This commit is contained in:
@@ -26,6 +26,7 @@ package net.fabricmc.loom.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import com.google.common.hash.HashCode;
|
||||
@@ -67,4 +68,13 @@ public class Checksum {
|
||||
HashCode hash = Hashing.sha256().hashString(string, StandardCharsets.UTF_8);
|
||||
return hash.asBytes();
|
||||
}
|
||||
|
||||
public static String truncatedSha256(File file) {
|
||||
try {
|
||||
HashCode hash = Files.asByteSource(file).hash(Hashing.sha256());
|
||||
return hash.toString().substring(0, 12);
|
||||
} catch (IOException e) {
|
||||
throw new UncheckedIOException("Failed to get file hash of " + file, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user