Commit c4541c8f authored by Him188's avatar Him188

Fix directory detecting

parent f175d07c
...@@ -86,7 +86,7 @@ actual open class BotConfiguration : BotConfigurationBase() { // open for Java ...@@ -86,7 +86,7 @@ actual open class BotConfiguration : BotConfigurationBase() { // open for Java
file: File = File("mirai.log"), file: File = File("mirai.log"),
identity: (bot: Bot) -> String = { "Net ${it.id}" } identity: (bot: Bot) -> String = { "Net ${it.id}" }
) { ) {
require(!file.isFile) { "file must not be a dir" } require(!file.isDirectory) { "file must not be a dir" }
file.createNewFile() file.createNewFile()
networkLoggerSupplier = { SingleFileLogger(identity(it), file) } networkLoggerSupplier = { SingleFileLogger(identity(it), file) }
} }
...@@ -122,7 +122,7 @@ actual open class BotConfiguration : BotConfigurationBase() { // open for Java ...@@ -122,7 +122,7 @@ actual open class BotConfiguration : BotConfigurationBase() { // open for Java
file: File, file: File,
identity: (bot: Bot) -> String = { "Net ${it.id}" } identity: (bot: Bot) -> String = { "Net ${it.id}" }
) { ) {
require(!file.isFile) { "file must not be a dir" } require(!file.isDirectory) { "file must not be a dir" }
file.createNewFile() file.createNewFile()
botLoggerSupplier = { SingleFileLogger(identity(it), file) } botLoggerSupplier = { SingleFileLogger(identity(it), file) }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment