[IJ] Setup working dir in RunTerminal.kt; Fit .gitignore rules; fix #366

This commit is contained in:
Karlatemp 2021-06-12 21:27:24 +08:00
parent 3d83fde396
commit f10dca99a6
No known key found for this signature in database
GPG Key ID: 21FBDDF664FF06F8
2 changed files with 19 additions and 0 deletions

View File

@ -122,5 +122,16 @@ run/
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar !gradle-wrapper.jar
### Mirai Console Files ###
# Local Test Launch point # Local Test Launch point
src/test/kotlin/RunTerminal.kt src/test/kotlin/RunTerminal.kt
# Mirai console files with direct bootstrap
/config
/data
/plugins
/bots
# Local Test Launch Point working directory
/debug-sandbox

View File

@ -1,12 +1,20 @@
package $PACKAGE_NAME package $PACKAGE_NAME
import java.io.File
import net.mamoe.mirai.alsoLogin import net.mamoe.mirai.alsoLogin
import net.mamoe.mirai.console.MiraiConsole import net.mamoe.mirai.console.MiraiConsole
import net.mamoe.mirai.console.plugin.PluginManager.INSTANCE.enable import net.mamoe.mirai.console.plugin.PluginManager.INSTANCE.enable
import net.mamoe.mirai.console.plugin.PluginManager.INSTANCE.load import net.mamoe.mirai.console.plugin.PluginManager.INSTANCE.load
import net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader import net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader
fun setupWorkingDir() {
// see: net.mamoe.mirai.console.terminal.MiraiConsoleImplementationTerminal
System.setProperty("user.dir", File("debug-sandbox").absolutePath)
}
suspend fun main() { suspend fun main() {
setupWorkingDir()
MiraiConsoleTerminalLoader.startAsDaemon() MiraiConsoleTerminalLoader.startAsDaemon()
val pluginInstance = ${CLASS_NAME}#if (${LANGUAGE_TYPE} != "Kotlin").INSTANCE #end val pluginInstance = ${CLASS_NAME}#if (${LANGUAGE_TYPE} != "Kotlin").INSTANCE #end