in gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractRunDistributableTask.kt [34:56]
fun run() {
val appDir = appImageRootDir.ioFile.let { appImageRoot ->
val files = appImageRoot.listFiles()
// Sometimes ".DS_Store" files are created on macOS, so ignore them.
?.filterNot { it.name == ".DS_Store" }
if (files == null || files.isEmpty()) {
error("Could not find application image: $appImageRoot is empty!")
} else if (files.size > 1) {
error("Could not find application image: $appImageRoot contains multiple children [${files.joinToString(", ")}]")
} else files.single()
}
val appExecutableName = executableName(packageName.get())
val (workingDir, executable) = when (currentOS) {
OS.Linux -> appDir to "bin/$appExecutableName"
OS.Windows -> appDir to appExecutableName
OS.MacOS -> appDir.resolve("Contents") to "MacOS/$appExecutableName"
}
execOperations.exec { spec ->
spec.workingDir(workingDir)
spec.executable(workingDir.resolve(executable).absolutePath)
}.assertNormalExitValue()
}