From 246de9177106329062132b39c83f930135687db5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergej=20Ko=C5=A1=C4=8Dejev?= Date: Fri, 23 Oct 2026 14:25:51 +0200 Subject: [PATCH] fix: expand Windows %IDE_HOME% in MPS bootstrap JVM arguments Fixes #111 --- .../daemoncomms/FullClasspathDaemonLauncher.kt | 4 +++- .../mops/cli/FullClasspathDaemonLauncherTest.kt | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/cli/src/main/kotlin/com/specificlanguages/mops/daemoncomms/FullClasspathDaemonLauncher.kt b/cli/src/main/kotlin/com/specificlanguages/mops/daemoncomms/FullClasspathDaemonLauncher.kt index cb1b8557..1b56b66d 100644 --- a/cli/src/main/kotlin/com/specificlanguages/mops/daemoncomms/FullClasspathDaemonLauncher.kt +++ b/cli/src/main/kotlin/com/specificlanguages/mops/daemoncomms/FullClasspathDaemonLauncher.kt @@ -255,7 +255,9 @@ class FullClasspathDaemonLauncher( mpsHome.resolve("Resources/product-info.json"), ).firstOrNull(Files::isRegularFile) ?: return emptyList() val launch = selectMpsLaunch(readMpsLaunches(descriptor), hostPlatform(osName, osArch, descriptor), descriptor) - return launch.bootstrapJvmArgs.map { it.replace("\$IDE_HOME", mpsHome.pathString) } + return launch.bootstrapJvmArgs.map { + it.replace("%IDE_HOME%", mpsHome.pathString).replace("\$IDE_HOME", mpsHome.pathString) + } } private fun readMpsLaunches(descriptor: Path): List = diff --git a/cli/src/test/kotlin/com/specificlanguages/mops/cli/FullClasspathDaemonLauncherTest.kt b/cli/src/test/kotlin/com/specificlanguages/mops/cli/FullClasspathDaemonLauncherTest.kt index 87b329c6..4e7b42ea 100644 --- a/cli/src/test/kotlin/com/specificlanguages/mops/cli/FullClasspathDaemonLauncherTest.kt +++ b/cli/src/test/kotlin/com/specificlanguages/mops/cli/FullClasspathDaemonLauncherTest.kt @@ -63,6 +63,20 @@ class FullClasspathDaemonLauncherTest { assertEquals(emptyList(), FullClasspathDaemonLauncher.mpsBootstrapJvmArgs(tempDir, "Linux", "amd64")) } + @Test + fun `bootstrap classpath resolves Windows IDE home placeholder in a path with spaces`() { + val mpsHome = tempDir.resolve("Program Files/JetBrains/MPS 2026.2").createDirectories() + mpsHome.resolve("product-info.json").writeText( + """{"launch":[{"os":"Windows","arch":"amd64","bootClassPathJarNames":[], + "additionalJvmArguments":["-Xbootclasspath/a:%IDE_HOME%/lib/nio-fs.jar"]}]}""", + ) + + assertEquals( + listOf("-Xbootclasspath/a:$mpsHome/lib/nio-fs.jar"), + FullClasspathDaemonLauncher.mpsBootstrapJvmArgs(mpsHome, "Windows 11", "amd64"), + ) + } + @Test fun `exact host launch entry is preferred`() { val mpsHome = tempDir.resolve("mps").createDirectories()