浏览代码

Fix directory detecting

Him188 5 年之前
父节点
当前提交
c4541c8fdc
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/BotConfiguration.kt

+ 2 - 2
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/BotConfiguration.kt

@@ -86,7 +86,7 @@ actual open class BotConfiguration : BotConfigurationBase() { // open for Java
         file: File = File("mirai.log"),
         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()
         networkLoggerSupplier = { SingleFileLogger(identity(it), file) }
     }
@@ -122,7 +122,7 @@ actual open class BotConfiguration : BotConfigurationBase() { // open for Java
         file: File,
         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()
         botLoggerSupplier = { SingleFileLogger(identity(it), file) }
     }