Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Say when the snapshot can't make a picture, not only when it can't save one

Țugui Dragoș20a193c859e6
diff --git a/Peel/HomeSnapshot.swift b/Peel/HomeSnapshot.swift
index 999da03f..cb308f6c 100644
--- a/Peel/HomeSnapshot.swift
+++ b/Peel/HomeSnapshot.swift
@@ -116,9 +116,9 @@ enum HomeSnapshot {
let renderer = ImageRenderer(content: content)
renderer.scale = 2
guard let image = renderer.nsImage, let data = image.tiffRepresentation,
- let bitmap = NSBitmapImageRep(data: data)
- else { return }
- try bitmap.representation(using: .png, properties: [:])?.write(to: URL(filePath: path))
+ let png = NSBitmapImageRep(data: data)?.representation(using: .png, properties: [:])
+ else { throw CocoaError(.fileWriteUnknown, userInfo: [NSFilePathErrorKey: path]) }
+ try png.write(to: URL(filePath: path))
}
}
#endif