feat(config): 第一次运行将提醒用户更改配置文件.

之前忘记添加这个提醒了, 首次运行的时候, `config.json` 和 `bot.json` 是不存在的, 所以根据这两个文件的存在与否, 来判定并提醒用户更改配置文件.
This commit is contained in:
LamGC 2022-05-02 02:18:23 +08:00
parent f11290c73d
commit e8b746b3f8
Signed by: LamGC
GPG Key ID: 6C5AE2A913941E1D

View File

@ -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 {