mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Handle mkdirs() failing better.
Kind of fixes https://github.com/cbeust/kobalt/issues/181 but not really.
This commit is contained in:
parent
5799af8e37
commit
1a0af4582d
1 changed files with 10 additions and 4 deletions
|
@ -251,12 +251,18 @@ public class Main {
|
||||||
// Save wrapperVersion.txt
|
// Save wrapperVersion.txt
|
||||||
//
|
//
|
||||||
log(2, " Writing " + VERSION_TXT);
|
log(2, " Writing " + VERSION_TXT);
|
||||||
VERSION_TXT.getParentFile().mkdirs();
|
File parentDir = VERSION_TXT.getParentFile();
|
||||||
|
boolean success = parentDir.mkdirs();
|
||||||
|
if (success) {
|
||||||
try (FileWriter fw = new FileWriter(VERSION_TXT)) {
|
try (FileWriter fw = new FileWriter(VERSION_TXT)) {
|
||||||
try (BufferedWriter bw = new BufferedWriter(fw)) {
|
try (BufferedWriter bw = new BufferedWriter(fw)) {
|
||||||
bw.write(wrapperVersion);
|
bw.write(wrapperVersion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log(1, "Warning: could not create the directory " + parentDir.getAbsolutePath()
|
||||||
|
+ ", can't write " + VERSION_TXT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateKobaltW(Path filePath) throws IOException {
|
private void generateKobaltW(Path filePath) throws IOException {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue