import AppKit import Foundation // Reports the LaunchServices identity REA relies on for one PID. // Usage: swift check-app-identity.swift guard CommandLine.arguments.count > 1, let pid = Int32(CommandLine.arguments[1]) else { FileHandle.standardError.write(Data("usage: check-app-identity.swift \n".utf8)) exit(2) } guard let app = NSRunningApplication(processIdentifier: pid) else { print("pid=\(pid) NSRunningApplication=nil (process not registered with LaunchServices)") exit(0) } print("pid=\(pid) bundleIdentifier=\(app.bundleIdentifier ?? "nil")") print("localizedName=\(app.localizedName ?? "nil")") print("bundleURL=\(app.bundleURL?.path ?? "nil")") print("launchDate=\(app.launchDate.map { String($0.timeIntervalSince1970) } ?? "nil")") print("activationPolicy=\(app.activationPolicy.rawValue)")