A shepherd for your Appimages.
0

Configure Feed

Select the types of activity you want to include in your feed.

icons: simplify preference

Aly Raffauf (Jun 19, 2026, 3:45 AM EDT) 96bdba96 36d1bcca

+6 -13
+6 -13
internal/appherder/icons.go
··· 30 30 var picker iconPicker 31 31 for _, entry := range entries { 32 32 if !entry.IsDir() { 33 - picker.consider(entry.Name(), entry) 33 + picker.consider(entry.Name()) 34 34 } 35 35 } 36 36 return picker.best ··· 43 43 if err != nil || entry.IsDir() { 44 44 return nil 45 45 } 46 - picker.consider(name, entry) 46 + picker.consider(name) 47 47 return nil 48 48 }) 49 49 } 50 50 return picker.best 51 51 } 52 52 53 - // iconPicker keeps the best icon seen, preferring format rank then larger size. 53 + // iconPicker keeps the best icon seen, preferring svg > png > xpm. 54 54 type iconPicker struct { 55 55 best string 56 56 rank int 57 - size int64 58 57 } 59 58 60 - func (p *iconPicker) consider(name string, entry fs.DirEntry) { 59 + func (p *iconPicker) consider(name string) { 61 60 rank := iconRank(name) 62 - if rank < 0 { 61 + if rank < 0 || (p.best != "" && rank <= p.rank) { 63 62 return 64 63 } 65 - info, err := entry.Info() 66 - if err != nil { 67 - return 68 - } 69 - if p.best == "" || rank > p.rank || (rank == p.rank && info.Size() > p.size) { 70 - p.best, p.rank, p.size = name, rank, info.Size() 71 - } 64 + p.best, p.rank = name, rank 72 65 } 73 66 74 67 // iconRank ranks icon extensions (higher preferred); -1 means not an icon.