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

Commit 8497176

Browse files
committed
Create data, plugin and config directory at framework startup
1 parent 22a3fab commit 8497176

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/main/scala/org/codeoverflow/chatoverflow/ChatOverflow.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.codeoverflow.chatoverflow
22

3+
import java.io.File
34
import java.security.Policy
45

56
import org.codeoverflow.chatoverflow.api.APIVersion
@@ -49,6 +50,9 @@ class ChatOverflow(val pluginFolderPath: String,
4950

5051
logger debug "Initialization started."
5152

53+
logger debug "Ensuring that all required directories exist."
54+
createDirectories()
55+
5256
logger debug "Enabling framework security policy."
5357
enableFrameworkSecurity()
5458

@@ -99,6 +103,11 @@ class ChatOverflow(val pluginFolderPath: String,
99103
System.setSecurityManager(new SecurityManager)
100104
}
101105

106+
private def createDirectories(): Unit = {
107+
Set(pluginFolderPath, configFolderPath, Launcher.pluginDataPath)
108+
.foreach(path => new File(path).mkdir())
109+
}
110+
102111
/**
103112
* Saves all settings and credentials to the corresponding files in the config folder.
104113
*/

0 commit comments

Comments
 (0)