mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 00:17:11 -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,11 +251,17 @@ public class Main {
|
|||
// Save wrapperVersion.txt
|
||||
//
|
||||
log(2, " Writing " + VERSION_TXT);
|
||||
VERSION_TXT.getParentFile().mkdirs();
|
||||
try (FileWriter fw = new FileWriter(VERSION_TXT)) {
|
||||
try (BufferedWriter bw = new BufferedWriter(fw)) {
|
||||
bw.write(wrapperVersion);
|
||||
File parentDir = VERSION_TXT.getParentFile();
|
||||
boolean success = parentDir.mkdirs();
|
||||
if (success) {
|
||||
try (FileWriter fw = new FileWriter(VERSION_TXT)) {
|
||||
try (BufferedWriter bw = new BufferedWriter(fw)) {
|
||||
bw.write(wrapperVersion);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log(1, "Warning: could not create the directory " + parentDir.getAbsolutePath()
|
||||
+ ", can't write " + VERSION_TXT);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue