diff --git a/src/main/kotlin/commands/dev/DevCommand.kt b/src/main/kotlin/commands/dev/DevCommand.kt index b7da4b2..0884c99 100644 --- a/src/main/kotlin/commands/dev/DevCommand.kt +++ b/src/main/kotlin/commands/dev/DevCommand.kt @@ -12,8 +12,11 @@ import com.github.ajalt.clikt.parameters.options.help import com.github.ajalt.clikt.parameters.options.option import com.github.ajalt.clikt.parameters.types.file import com.github.ajalt.clikt.parameters.types.long +import com.github.ajalt.clikt.parameters.types.path import com.sun.security.auth.module.UnixSystem import java.io.File +import kotlin.io.path.absolute +import kotlin.io.path.absolutePathString const val LOG4J_CONFIG = """ @@ -52,11 +55,11 @@ class DevCommand : CliktCommand("dev") { if (System.getProperty("os.name").lowercase() == "windows" ) 2050 else (UnixSystem().uid + 1010) ).help("Port for Server") - val world by option("--world", "-w").help("User World") - val plugins by option("--plugins", "-p").help("Plugin Dir") + val world by option("--world", "-w").path(canBeFile = false).help("User World") + val plugins by option("--plugins", "-p").path(true, canBeFile = false).help("Plugin Dir") val profile by option().flag().help("Add Profiling Arguments") val forceUpgrade by option().flag().help("Force Upgrade") - val jar by option().file().help("Jar File") + val jar by option().file(true, canBeDir = false).help("Jar File") val jvmArgs by argument().multiple() override val printHelpOnEmptyArgs = true @@ -76,7 +79,7 @@ class DevCommand : CliktCommand("dev") { } else { setLogConfig(args) val version = findVersion(server) ?: throw CliktError("Unknown Server Version") - val worldFile = world?.let { File(workingDir, it) } ?: File(serverDir, "devtempworld") + val worldFile = world?.let { it.absolute().toFile() } ?: File(serverDir, "devtempworld") val jarFile = jar?.absolutePath ?: JARS[server]?.let { VERSIONS[it] } ?: VERSIONS[version] ?: throw CliktError("Unknown Server Version") @@ -101,7 +104,7 @@ class DevCommand : CliktCommand("dev") { "--level-name", worldFile.name, "--world-dir", workingDir.absolutePath, "--nogui", - *(if (plugins != null) arrayOf("--plugins", plugins!!) else arrayOf()) + *(if (plugins != null) arrayOf("--plugins", plugins!!.absolutePathString()) else arrayOf()) ), serverDir )