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

Commit c028b72

Browse files
authored
Merge pull request #15 from daniel0611/create-config-dir
Create config dir, if it isn't existent in main framework instead of Bootstrap Launcher
2 parents 1cd8df6 + b76367b commit c028b72

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)