diff --git a/tools/intellij-plugin/resources/fileTemplates/j2ee/.gitignore.ft b/tools/intellij-plugin/resources/fileTemplates/j2ee/.gitignore.ft index 9e0fdadec..9fdb2af26 100644 --- a/tools/intellij-plugin/resources/fileTemplates/j2ee/.gitignore.ft +++ b/tools/intellij-plugin/resources/fileTemplates/j2ee/.gitignore.ft @@ -122,5 +122,16 @@ run/ # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) !gradle-wrapper.jar +### Mirai Console Files ### + # Local Test Launch point src/test/kotlin/RunTerminal.kt + +# Mirai console files with direct bootstrap +/config +/data +/plugins +/bots + +# Local Test Launch Point working directory +/debug-sandbox diff --git a/tools/intellij-plugin/resources/fileTemplates/j2ee/RunTerminal.kt.ft b/tools/intellij-plugin/resources/fileTemplates/j2ee/RunTerminal.kt.ft index 78238f47d..775dfe25e 100644 --- a/tools/intellij-plugin/resources/fileTemplates/j2ee/RunTerminal.kt.ft +++ b/tools/intellij-plugin/resources/fileTemplates/j2ee/RunTerminal.kt.ft @@ -1,12 +1,20 @@ package $PACKAGE_NAME +import java.io.File import net.mamoe.mirai.alsoLogin import net.mamoe.mirai.console.MiraiConsole import net.mamoe.mirai.console.plugin.PluginManager.INSTANCE.enable import net.mamoe.mirai.console.plugin.PluginManager.INSTANCE.load 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() { + setupWorkingDir() + MiraiConsoleTerminalLoader.startAsDaemon() val pluginInstance = ${CLASS_NAME}#if (${LANGUAGE_TYPE} != "Kotlin").INSTANCE #end