Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions Click2Minimize/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -463,12 +463,28 @@ class AppDelegate: NSObject, NSApplicationDelegate {
// Mount the DMG
let mountTask = Process()
mountTask.launchPath = "/usr/bin/hdiutil"
mountTask.arguments = ["attach", localURL.path]
mountTask.arguments = ["attach", localURL.path, "-plist", "-nobrowse"]

let pipe = Pipe()
mountTask.standardOutput = pipe

mountTask.terminationHandler = { process in
if process.terminationStatus == 0 {
let data = pipe.fileHandleForReading.readDataToEndOfFile()
var dynamicMountPath = "/Volumes/Click2Minimize"

if let plist = try? PropertyListSerialization.propertyList(from: data, options: [], format: nil) as? [String: Any],
let systemEntities = plist["system-entities"] as? [[String: Any]] {
for entity in systemEntities {
if let mountPoint = entity["mount-point"] as? String {
dynamicMountPath = mountPoint
break
}
}
}

// Get the mounted volume path
let mountedVolumePath = "/Volumes/Click2Minimize" // Adjust this if the volume name is different
let mountedVolumePath = dynamicMountPath // Dynamically resolved mount point
let appDestinationURL = URL(fileURLWithPath: "/Applications/Click2Minimize.app") // Change to /Applications

do {
Expand Down
Binary file removed dist/Click2Minimize.dmg
Binary file not shown.