Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit b76367b

Browse files
committed
Create config dir, if it isn't existent in main framework instead of Bootstrap Launcher
On the first start the default config should be saved, which fails if the folder doesn't exist. This creates a problem when you try to login to the gui. The framework can't be loaded because the config with plugins and connectors don't exist and you won't be able to login, until you create the config directory and restart. A check for the config dir was in the Bootstrap Launcher, but when you run Chat Overflow in IntelliJ that check isn't working. So I added that check in the main framework.
1 parent ac09a8c commit b76367b

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

bootstrap/src/main/scala/Bootstrap.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ object Bootstrap {
3434
if (javaPath.isDefined) {
3535
println("Found java installation. Starting ChatOverflow...")
3636

37-
// Create config folder, if not existent
38-
if (!new File("config/").exists()) {
39-
new File("config/").mkdir()
40-
}
41-
4237
// Start chat overflow!
4338
val process = new java.lang.ProcessBuilder(javaPath.get, "-cp", s"bin/*${File.pathSeparator}lib/*", chatOverflowMainClass)
4439
.inheritIO().start()

src/main/scala/org/codeoverflow/chatoverflow/configuration/ConfigurationService.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ class ConfigurationService(val configFilePath: String) extends WithLogger {
153153
* Saves the xml content to the config xml.
154154
*/
155155
private def saveXML(xmlContent: Node): Unit = {
156+
// Create config folder, if not existent
157+
val dir = new File(configFilePath).getParentFile
158+
if(!dir.exists()) {
159+
dir.mkdir()
160+
}
161+
156162
val writer = new PrintWriter(configFilePath)
157163
writer.print(new PrettyPrinter(120, 2).format(xmlContent))
158164
writer.close()

0 commit comments

Comments
 (0)