diff --git a/server/src/main/kotlin/ir/armor/tachidesk/server/ServerSetup.kt b/server/src/main/kotlin/ir/armor/tachidesk/server/ServerSetup.kt index 935eec6..516b541 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/server/ServerSetup.kt +++ b/server/src/main/kotlin/ir/armor/tachidesk/server/ServerSetup.kt @@ -43,15 +43,16 @@ val systemTray by lazy { systemTray() } val androidCompat by lazy { AndroidCompat() } -fun applicationSetup(rootDir: String? = null) { +fun applicationSetup() { + val rootDir: String? = System.getProperty("ir.armor.tachidesk.rootDir") val dirs = if (rootDir != null) { ApplicationDirs(rootDir) } else { - ApplicationDirs() + ApplicationDirs().also { + System.setProperty("ir.armor.tachidesk.rootDir", it.dataRoot) + } } - System.setProperty("ir.armor.tachidesk.rootDir", dirs.dataRoot) - // make dirs we need listOf( dirs.dataRoot, diff --git a/server/src/test/kotlin/ir/armor/tachidesk/TestExtensions.kt b/server/src/test/kotlin/ir/armor/tachidesk/TestExtensions.kt index 574bb9d..500309e 100644 --- a/server/src/test/kotlin/ir/armor/tachidesk/TestExtensions.kt +++ b/server/src/test/kotlin/ir/armor/tachidesk/TestExtensions.kt @@ -41,7 +41,8 @@ class TestExtensions { @BeforeAll fun setup() { val dataRoot = File("tmp/TestDesk").absolutePath - applicationSetup(dataRoot) + System.setProperty("ir.armor.tachidesk.rootDir", dataRoot) + applicationSetup() setLoggingEnabled(false) runBlocking { extensions = getExtensionList()