mirror of
https://github.com/LamGC/ScalaBot.git
synced 2025-04-29 22:27:31 +00:00
fix: 修复因文件访问比初始化早而导致的启动错误问题.
由于 Launcher 比 initialFiles 更早的执行, 调用 Const 导致更早的访问了未初始化的文件, 导致第一次启动会出现错误. 改动中将 Launcher 移入 main 方法不会有影响, 相比于在 AppPaths.<init> 中初始化会更安全.
This commit is contained in:
parent
e12f858690
commit
93cf5c4e2f
@ -13,14 +13,14 @@ import kotlin.system.exitProcess
|
|||||||
|
|
||||||
private val log = KotlinLogging.logger { }
|
private val log = KotlinLogging.logger { }
|
||||||
|
|
||||||
private val launcher = Launcher()
|
|
||||||
.registerShutdownHook()
|
|
||||||
|
|
||||||
fun main(args: Array<String>): Unit = runBlocking {
|
fun main(args: Array<String>): Unit = runBlocking {
|
||||||
log.info { "ScalaBot 正在启动中..." }
|
log.info { "ScalaBot 正在启动中..." }
|
||||||
log.info { "数据目录: ${AppPaths.DATA_ROOT}" }
|
log.info { "数据目录: ${AppPaths.DATA_ROOT}" }
|
||||||
log.debug { "启动参数: ${args.joinToString(prefix = "[", postfix = "]")}" }
|
log.debug { "启动参数: ${args.joinToString(prefix = "[", postfix = "]")}" }
|
||||||
initialFiles()
|
initialFiles()
|
||||||
|
|
||||||
|
val launcher = Launcher()
|
||||||
|
.registerShutdownHook()
|
||||||
if (Const.config.metrics.enable) {
|
if (Const.config.metrics.enable) {
|
||||||
startMetricsServer()
|
startMetricsServer()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user