diff --git a/Click2Minimize/AppDelegate.swift b/Click2Minimize/AppDelegate.swift index 55a4109..191da5e 100644 --- a/Click2Minimize/AppDelegate.swift +++ b/Click2Minimize/AppDelegate.swift @@ -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 { diff --git a/dist/Click2Minimize.dmg b/dist/Click2Minimize.dmg deleted file mode 100644 index 12a0b0d..0000000 Binary files a/dist/Click2Minimize.dmg and /dev/null differ