Skip to content

Commit

Permalink
Escape resources dir separator on Windows (#1005)
Browse files Browse the repository at this point in the history
Resolves #999
  • Loading branch information
AlexeyTsvetkov authored Aug 5, 2021
1 parent 3496cad commit 7870d66
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,14 @@ abstract class AbstractJPackageTask @Inject constructor(
private val libsMapping = FilesMapping()

override fun makeArgs(tmpDir: File): MutableList<String> = super.makeArgs(tmpDir).apply {
fun appDir(vararg pathParts: String): String =
listOf("${'$'}APPDIR", *pathParts).joinToString(File.separator) { it }
fun appDir(vararg pathParts: String): String {
/** For windows we need to pass '\\' to jpackage file, each '\' need to be escaped.
Otherwise '$APPDIR\resources' is passed to jpackage,
and '\r' is treated as a special character at run time.
*/
val separator = if (currentTarget.os == OS.Windows) "\\\\" else "/"
return listOf("${'$'}APPDIR", *pathParts).joinToString(separator) { it }
}

if (targetFormat == TargetFormat.AppImage || appImage.orNull == null) {
// Args, that can only be used, when creating an app image or an installer w/o --app-image parameter
Expand Down

0 comments on commit 7870d66

Please sign in to comment.