Commit 6bb3f284 authored by Adrien's avatar Adrien

rename installers after unzip

parent 93b47f32
......@@ -25,7 +25,7 @@ class MacCodeSign {
val separator = System.getProperty("file.separator")
fun signMacProduct(zipFile: File): File {
val file: File = unzip(zipFile);
val file: File = unzip(zipFile, false);
if (!zipFile.delete()) {
logger.error("Failed to delete temp file $zipFile")
throw Throwable()
......@@ -51,7 +51,7 @@ class MacCodeSign {
}
fun buildAndSignMacInstaller(zipFile: File): File {
val file: File = unzip(zipFile);
val file: File = unzip(zipFile, true);
if (!zipFile.delete()) {
throw Throwable("Failed to delete temp file $zipFile")
}
......@@ -96,16 +96,25 @@ class MacCodeSign {
return dmg
}
fun unzip(zipFile: File): File {
fun unzip(zipFile: File, rename: Boolean): File {
ProcessBuilder()
.inheritIO()
.command("unzip", zipFile.canonicalPath, "-d", zipFile.parentFile.canonicalPath)
.start()
.waitFor()
if (rename) { // the installer generated by bitrock doesn't have the .app ..
var folderName : String = zipFile.parentFile.canonicalPath + separator + zipFile.nameWithoutExtension
ProcessBuilder()
.inheritIO()
.command("mv", folderName, folderName + ".app")
.start()
.waitFor()
}
var file: File = File(zipFile.parentFile.canonicalPath + separator + zipFile.nameWithoutExtension + ".app")
if (!file.exists()) {
logger.error("failed to unzip $zipFile")
throw Throwable()
throw Throwable("failed to unzip $zipFile")
}
return file
}
......@@ -119,8 +128,7 @@ class MacCodeSign {
.waitFor()
var zipFile = File(zipPath)
if (!zipFile.exists()) {
logger.error("failed to unzip $file")
throw Throwable()
throw Throwable("failed to zip $file")
}
return zipFile
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment