Skip to content

Commit 8b0afe1

Browse files
committed
Fix HashStore not creating parent directories if necessary
1 parent a0a7f85 commit 8b0afe1

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

hash-utils/src/main/java/net/minecraftforge/util/hash/HashStore.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ public void save(File file) {
197197
buf.append(key).append('=').append(this.newHashes.get(key)).append('\n');
198198

199199
try {
200+
Files.createDirectories(file.getParentFile().toPath());
200201
Files.write(file.toPath(), buf.toString().getBytes(StandardCharsets.UTF_8));
201202
this.saved = true;
202203
} catch (IOException e) {

hash-utils/src/main/java/net/minecraftforge/util/hash/HashUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ public static void updateHash(File target, HashFunction... functions) throws IOE
7979
for (int x = 0; x < functions.length; x++) {
8080
HashFunction func = functions[x];
8181
File cache = new File(target.getAbsolutePath() + "." + func.extension());
82+
Files.createDirectories(cache.getParentFile().toPath());
8283
Files.write(cache.toPath(), hashes[x].getBytes());
8384
}
8485
}

0 commit comments

Comments
 (0)