Skip to content

Commit

Permalink
fix: always find primary app icon (#656)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMoonThatRises committed Dec 30, 2022
1 parent 4639fc1 commit 9ccee00
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions PlayCover/Utils/Cacher.swift
Expand Up @@ -27,6 +27,18 @@ class Cacher {
func resolveLocalIcon(_ app: PlayApp) -> NSImage? {
var bestResImage: NSImage?
let compareStr = app.info.bundleIdentifier + app.info.bundleVersion

do {
try app.url.enumerateContents { file, _ in
if file.lastPathComponent.contains(app.info.primaryIconName), let icon = NSImage(contentsOf: file),
checkImageDimensions(icon, bestResImage) {
bestResImage = icon
}
}
} catch {
Log.shared.error(error)
}

if let assetsExtractor = try? AssetsExtractor(appUrl: app.url) {
for icon in assetsExtractor.extractIcons() where checkImageDimensions(icon, bestResImage) {
bestResImage = icon
Expand Down

0 comments on commit 9ccee00

Please sign in to comment.