mirror of
https://github.com/maxgoedjen/secretive.git
synced 2025-04-10 17:47:19 +00:00
Fix #478
This commit is contained in:
parent
5bf5be6c25
commit
fed931ebd5
@ -60,7 +60,10 @@ extension SigningRequestTracer {
|
|||||||
func iconURL(for pid: Int32) -> URL? {
|
func iconURL(for pid: Int32) -> URL? {
|
||||||
do {
|
do {
|
||||||
if let app = NSRunningApplication(processIdentifier: pid), let icon = app.icon?.tiffRepresentation {
|
if let app = NSRunningApplication(processIdentifier: pid), let icon = app.icon?.tiffRepresentation {
|
||||||
let temporaryURL = URL(fileURLWithPath: (NSTemporaryDirectory() as NSString).appendingPathComponent("\(UUID().uuidString).png"))
|
let temporaryURL = URL(fileURLWithPath: (NSTemporaryDirectory() as NSString).appendingPathComponent("\(app.bundleIdentifier ?? UUID().uuidString).png"))
|
||||||
|
if FileManager.default.fileExists(atPath: temporaryURL.path) {
|
||||||
|
return temporaryURL
|
||||||
|
}
|
||||||
let bitmap = NSBitmapImageRep(data: icon)
|
let bitmap = NSBitmapImageRep(data: icon)
|
||||||
try bitmap?.representation(using: .png, properties: [:])?.write(to: temporaryURL)
|
try bitmap?.representation(using: .png, properties: [:])?.write(to: temporaryURL)
|
||||||
return temporaryURL
|
return temporaryURL
|
||||||
|
Loading…
Reference in New Issue
Block a user