2
0
Fork 0
mirror of https://github.com/ethauvin/bld.git synced 2025-04-25 16:27:11 -07:00

Bld cache fixes for windows

This commit is contained in:
Geert Bevin 2024-07-19 08:45:07 -04:00
parent 8c42052e2e
commit f86b7fb40c

View file

@ -10,10 +10,7 @@ import rife.bld.dependencies.VersionResolution;
import rife.bld.wrapper.Wrapper; import rife.bld.wrapper.Wrapper;
import rife.tools.StringUtils; import rife.tools.StringUtils;
import java.io.File; import java.io.*;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
@ -120,7 +117,9 @@ public class BldCache {
var properties = new Properties(); var properties = new Properties();
if (getCacheFile().exists()) { if (getCacheFile().exists()) {
try { try {
properties.load(new FileInputStream(getCacheFile())); try (var reader = new BufferedReader(new FileReader(getCacheFile()))) {
properties.load(reader);
}
} catch (IOException e) { } catch (IOException e) {
// no-op, we'll store a new properties file when we're writing the cache // no-op, we'll store a new properties file when we're writing the cache
} }
@ -207,7 +206,10 @@ public class BldCache {
} }
bldLibDir_.mkdirs(); bldLibDir_.mkdirs();
properties.store(new FileOutputStream(getCacheFile()), null);
try (var writer = new BufferedWriter(new FileWriter(getCacheFile()))) {
properties.store(writer, null);
}
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }