mirror of
https://github.com/jlengrand/compose-multiplatform.git
synced 2026-03-10 08:11:20 +00:00
Fix passing relative path main jar to jpackage
This commit is contained in:
@@ -108,5 +108,10 @@ internal fun File.checkExistingFile(): File =
|
||||
internal val File.isJarFile: Boolean
|
||||
get() = name.endsWith(".jar", ignoreCase = true) && isFile
|
||||
|
||||
internal fun File.normalizedPath() =
|
||||
if (currentOS == OS.Windows) absolutePath.replace("\\", "\\\\") else absolutePath
|
||||
internal fun File.normalizedPath(base: File? = null): String {
|
||||
val path = base?.let { relativeToOrNull(it)?.path } ?: absolutePath
|
||||
return when (currentOS) {
|
||||
OS.Windows -> path.replace("\\", "\\\\")
|
||||
else -> path
|
||||
}
|
||||
}
|
||||
@@ -321,8 +321,8 @@ abstract class AbstractJPackageTask @Inject constructor(
|
||||
|
||||
val mappedJar = libsMapping[launcherMainJar.ioFile]?.singleOrNull()
|
||||
?: error("Main jar was not processed correctly: ${launcherMainJar.ioFile}")
|
||||
val mainJarRelative = (if (currentTarget.os == OS.Windows) "\\" else "/") + mappedJar.relativeTo(libsDir.ioFile).toString()
|
||||
cliArg("--main-jar", mainJarRelative)
|
||||
val mainJarPath = mappedJar.normalizedPath(base = libsDir.ioFile)
|
||||
cliArg("--main-jar", mainJarPath)
|
||||
cliArg("--main-class", launcherMainClass)
|
||||
|
||||
if (currentOS == OS.Windows) {
|
||||
|
||||
Reference in New Issue
Block a user