feat: support for .icns icons

This commit is contained in:
relikd
2026-02-07 11:54:26 +01:00
parent e2743903e3
commit 8053110349
2 changed files with 11 additions and 12 deletions

View File

@@ -299,19 +299,18 @@ struct Entry {
}
func icon() -> NSImage? {
guard isDir else {
return nil
}
var img: NSImage? = nil
for ext in ["svg", "png", "jpg", "jpeg", "gif", "ico"] {
let iconPath = self.url.appendingPathComponent("icon." + ext)
if FileManager.default.fileExists(atPath: iconPath.path) {
img = NSImage(contentsOf: iconPath)
break
if isDir {
for ext in ["svg", "png", "jpg", "jpeg", "gif", "ico", "icns"] {
let iconPath = self.url.appendingPathComponent("icon." + ext)
if FileManager.default.fileExists(atPath: iconPath.path) {
img = NSImage(contentsOf: iconPath)
break
}
}
if img == nil {
img = NSImage(named: NSImage.folderName)
}
}
if img == nil {
img = NSImage(named: NSImage.folderName)
}
img?.size = NSMakeSize(16, 16)
return img