Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation on Windows #77

Merged
merged 2 commits into from
Dec 10, 2024
Merged

Fix compilation on Windows #77

merged 2 commits into from
Dec 10, 2024

Conversation

claytongreen
Copy link
Contributor

kotlinc uses a different separator on Windows vs Mac/Linux for -classpath
https://kotlinlang.org/docs/compiler-reference.html#classpath-path-cp-path

Copy link
Owner

@romainguy romainguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Small change request. There's an API in the JDK for this already.

@@ -34,7 +35,7 @@ class KotlinCompiler(private val toolPaths: ToolPaths, private val outputDirecto
toolPaths.kotlinc.toString(),
"-Xmulti-platform",
"-classpath",
(toolPaths.kotlinLibs + listOf(toolPaths.platform)).joinToString(":") { jar -> jar.toString() }
(toolPaths.kotlinLibs + listOf(toolPaths.platform)).joinToString(if (isWindows) ";" else ":") { jar -> jar.toString() }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A better solution is to use File.pathSeparator or (pathSeparatorChar): https://docs.oracle.com/javase/8/docs/api/java/io/File.html#pathSeparator

@romainguy romainguy mentioned this pull request Dec 10, 2024
@romainguy
Copy link
Owner

Thank you!

@romainguy romainguy merged commit 0cced88 into romainguy:main Dec 10, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants