mirror of
https://github.com/tachiyomiorg/tachiyomi-extensions-inspector.git
synced 2024-12-24 15:51:49 +01:00
use logger to print exception
This commit is contained in:
parent
e3f65d2192
commit
1eb4a9c216
@ -12,6 +12,7 @@ import eu.kanade.tachiyomi.App
|
||||
import ir.armor.tachidesk.Main
|
||||
import ir.armor.tachidesk.database.makeDataBaseTables
|
||||
import ir.armor.tachidesk.server.util.systemTray
|
||||
import mu.KotlinLogging
|
||||
import net.harawata.appdirs.AppDirsFactory
|
||||
import org.kodein.di.DI
|
||||
import org.kodein.di.conf.global
|
||||
@ -21,6 +22,8 @@ import xyz.nulldev.ts.config.ConfigKodeinModule
|
||||
import xyz.nulldev.ts.config.GlobalConfigManager
|
||||
import java.io.File
|
||||
|
||||
private val logger = KotlinLogging.logger {}
|
||||
|
||||
object applicationDirs {
|
||||
val dataRoot = AppDirsFactory.getInstance().getUserDataDir("Tachidesk", null, null)!!
|
||||
val extensionsRoot = "$dataRoot/extensions"
|
||||
@ -59,16 +62,14 @@ fun applicationSetup() {
|
||||
try {
|
||||
val dataConfFile = File("${applicationDirs.dataRoot}/server.conf")
|
||||
if (!dataConfFile.exists()) {
|
||||
val inpStream = Main::class.java.getResourceAsStream("/server-reference.conf")
|
||||
val outStream = dataConfFile.outputStream()
|
||||
|
||||
inpStream.copyTo(outStream)
|
||||
|
||||
inpStream.close()
|
||||
outStream.close()
|
||||
Main::class.java.getResourceAsStream("/server-reference.conf").use { input ->
|
||||
dataConfFile.outputStream().use { output ->
|
||||
input.copyTo(output)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
logger.error("Exception while creating initial server.conf:\n", e)
|
||||
}
|
||||
|
||||
makeDataBaseTables()
|
||||
|
Loading…
Reference in New Issue
Block a user