Better way of setting it maybe?

This commit is contained in:
Aria Moradi
2021-04-04 03:23:50 +04:30
parent 5171e509a5
commit 7a52e19235
4 changed files with 31 additions and 23 deletions
@@ -11,7 +11,6 @@ import com.typesafe.config.Config
import com.typesafe.config.ConfigFactory
import com.typesafe.config.ConfigRenderOptions
import mu.KotlinLogging
import net.harawata.appdirs.AppDirsFactory
import java.io.File
/**
@@ -47,7 +46,7 @@ open class ConfigManager {
//Load user config
val userConfig =
File(System.getProperty("ir.armor.tachidesk.rootDir"), "server.conf").let {
File(tachideskRootDir(), "server.conf").let {
ConfigFactory.parseFile(it)
}
@@ -0,0 +1,17 @@
package xyz.nulldev.ts.config
import net.harawata.appdirs.AppDirsFactory
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
fun tachideskRootDir(): String {
return System.getProperty(
"ir.armor.tachidesk.rootDir",
AppDirsFactory.getInstance().getUserDataDir("Tachidesk", null, null)
)
}