Skip to content

Commit 0040611

Browse files
committed
Load default config automatically
1 parent 91ac520 commit 0040611

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/main/java/com/vimasig/bozar/ui/ConfigManager.java

+6
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,10 @@ public BozarConfig generateConfig() {
8787
}
8888
return bozarConfig;
8989
}
90+
91+
public void loadDefaultConfig() throws IOException {
92+
File f = new File("bozarConfig.json");
93+
if(f.exists() && f.isFile())
94+
this.loadConfig(f);
95+
}
9096
}

src/main/java/com/vimasig/bozar/ui/Controller.java

+9
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import javafx.stage.FileChooser;
1010

1111
import java.io.File;
12+
import java.io.IOException;
1213
import java.io.OutputStream;
1314
import java.io.PrintStream;
1415
import java.nio.file.Path;
@@ -135,6 +136,14 @@ public void initialize() {
135136
libraries.getItems().remove(index);
136137
});
137138

139+
// Load default config
140+
try {
141+
this.configManager.loadDefaultConfig();
142+
} catch (IOException e) {
143+
e.printStackTrace();
144+
this.log("Cannot load default config");
145+
}
146+
138147
// Done
139148
log("Loaded.");
140149
}

0 commit comments

Comments
 (0)