mirror of
https://github.com/LamGC/ScalaBot.git
synced 2025-04-29 22:27:31 +00:00
feat(config): 第一次运行将提醒用户更改配置文件.
之前忘记添加这个提醒了, 首次运行的时候, `config.json` 和 `bot.json` 是不存在的, 所以根据这两个文件的存在与否, 来判定并提醒用户更改配置文件.
This commit is contained in:
parent
f11290c73d
commit
e8b746b3f8
@ -19,6 +19,7 @@ import java.io.File
|
||||
import java.net.URL
|
||||
import java.nio.charset.StandardCharsets
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
private val log = KotlinLogging.logger { }
|
||||
|
||||
@ -268,9 +269,17 @@ private fun AppPaths.defaultInitializer() {
|
||||
}
|
||||
|
||||
internal fun initialFiles() {
|
||||
val configFilesNotInitialized = !AppPaths.DEFAULT_CONFIG_APPLICATION.file.exists()
|
||||
&& !AppPaths.DEFAULT_CONFIG_BOT.file.exists()
|
||||
|
||||
for (path in AppPaths.values()) {
|
||||
path.initial()
|
||||
}
|
||||
|
||||
if (configFilesNotInitialized) {
|
||||
log.warn { "配置文件已初始化, 请根据需要修改配置文件后重新启动本程序." }
|
||||
exitProcess(1)
|
||||
}
|
||||
}
|
||||
|
||||
private object GsonConst {
|
||||
|
Loading…
Reference in New Issue
Block a user