mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-26 16:10:11 +08:00
Prefer device.json and auto-rename from deviceInfo.json
This commit is contained in:
parent
a9ca815627
commit
b250092e4e
@ -148,15 +148,26 @@ public interface MiraiConsole : CoroutineScope {
|
|||||||
|
|
||||||
mainLogger.verbose { "Bot $id working in $workingDir" }
|
mainLogger.verbose { "Bot $id working in $workingDir" }
|
||||||
|
|
||||||
// copy root/device.json to bots/id/deviceInfo.json
|
val deviceInRoot = MiraiConsole.rootDir.resolve("device.json")
|
||||||
val deviceInfoInRoot = MiraiConsole.rootDir.resolve("device.json")
|
val deviceInWorkingDir = workingDir.resolve("device.json")
|
||||||
val deviceInfoTarget = workingDir.resolve("deviceInfo.json")
|
|
||||||
if (deviceInfoInRoot.isFile && !deviceInfoTarget.isFile) {
|
val deviceInfoInWorkingDir = workingDir.resolve("deviceInfo.json")
|
||||||
mainLogger.verbose { "Coping $deviceInfoInRoot to $deviceInfoTarget" }
|
if (!deviceInWorkingDir.exists()) {
|
||||||
deviceInfoInRoot.copyTo(deviceInfoTarget)
|
when {
|
||||||
|
deviceInfoInWorkingDir.exists() -> {
|
||||||
|
// rename bots/id/deviceInfo.json to bots/id/device.json
|
||||||
|
mainLogger.verbose { "Renaming $deviceInfoInWorkingDir to $deviceInWorkingDir" }
|
||||||
|
deviceInfoInWorkingDir.renameTo(deviceInWorkingDir)
|
||||||
|
}
|
||||||
|
deviceInRoot.exists() -> {
|
||||||
|
// copy root/device.json to bots/id/device.json
|
||||||
|
mainLogger.verbose { "Coping $deviceInRoot to $deviceInWorkingDir" }
|
||||||
|
deviceInRoot.copyTo(deviceInWorkingDir)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fileBasedDeviceInfo("deviceInfo.json")
|
fileBasedDeviceInfo("device.json")
|
||||||
|
|
||||||
redirectNetworkLogToDirectory()
|
redirectNetworkLogToDirectory()
|
||||||
this.botLoggerSupplier = {
|
this.botLoggerSupplier = {
|
||||||
|
Loading…
Reference in New Issue
Block a user