add: custom working dir when start

This commit is contained in:
mzdluo123 2020-04-27 16:27:54 +08:00
parent 68690a62b1
commit 4947c8b7a6
2 changed files with 32 additions and 4 deletions

View File

@ -55,7 +55,7 @@ object MiraiConsole {
/** /**
* Console运行路径 * Console运行路径
*/ */
var path: String = System.getProperty("user.dir") lateinit var path: String
internal set internal set
/** /**
@ -68,19 +68,47 @@ object MiraiConsole {
private var started = false private var started = false
@Deprecated("for binary compatibility", level = DeprecationLevel.HIDDEN)
@Suppress("FunctionName")
@JvmSynthetic
@JvmStatic
fun /* synthetic */`start$default`(
miraiConsole: MiraiConsole,
miraiConsoleUI: MiraiConsoleUI?,
string: String?,
string2: String?,
n: Int,
@Suppress("UNUSED_PARAMETER") `object`: Any?
) {
@Suppress("NAME_SHADOWING")
var string = string
@Suppress("NAME_SHADOWING")
var string2 = string2
if (n and 2 != 0) {
string = "0.0.0"
}
if (n and 4 != 0) {
string2 = "0.0.0"
}
miraiConsole.start(miraiConsoleUI!!, string!!, string2!!)
}
/** /**
* 启动Console * 启动Console
*/ */
@JvmOverloads
fun start( fun start(
frontEnd: MiraiConsoleUI, frontEnd: MiraiConsoleUI,
coreVersion: String = "0.0.0", coreVersion: String = "0.0.0",
consoleVersion: String = "0.0.0" consoleVersion: String = "0.0.0",
path:String = System.getProperty("user.dir")
) { ) {
if (started) { if (started) {
return return
} }
started = true started = true
this.path = path
/* 初始化前端 */ /* 初始化前端 */
this.version = consoleVersion this.version = consoleVersion
this.frontEnd = frontEnd this.frontEnd = frontEnd

View File

@ -29,7 +29,7 @@ import java.util.jar.JarFile
object PluginManager { object PluginManager {
internal val pluginsPath = (System.getProperty("user.dir") + "/plugins/").replace("//", "/").also { internal val pluginsPath = (MiraiConsole.path + "/plugins/").replace("//", "/").also {
File(it).mkdirs() File(it).mkdirs()
} }