def createDMGLocally()

in src/main/scala/org/intellij/scala/bundle/MacHost.scala [17:49]


  def createDMGLocally(appTGZ: File, macProperties: File): Unit = {
    val properties = propertiesIn(macProperties)
    def property(key: String) = properties.getProperty(key).ensuring(_ != null, key)
    def exec(cmd: String) = {
      println(cmd)
      cmd.!
    }

    val parentDir = appTGZ.getParentFile
    val appName = appTGZ.getName.substring(0, appTGZ.getName.indexOf('.'))
    val appDirPath = Paths.get(parentDir.getAbsolutePath, appName)

    if (!Files.exists(appDirPath)) Files.createDirectory(appDirPath)

    exec(s"tar -zxvf ${appTGZ.getAbsolutePath} -C ${appDirPath.toString}")

    val codesign = property("codesign")

    val createDmgCmd =
      s"""
         |create-dmg --codesign "$codesign"
         | --no-internet-enable
         | --background "src/main/resources/mac/dmg_background.png"
         | --window-size 900 500
         | --app-drop-link 670 310
         | --icon "intellij-scala-bundle-2023-01-05.app" 250 310
         | --volname "IntelliJ Scala Bundle"
         | ${parentDir.getAbsolutePath}/${appName}.dmg
         | ${appDirPath.toString}
         |""".stripMargin.trim

    exec(createDmgCmd)
  }