Icon theme parsing properly stores rooted dir paths

This commit is contained in:
Sasha Koshka 2024-04-28 23:16:01 -04:00
parent c465ff6d1e
commit 39e6d0187e
1 changed files with 7 additions and 3 deletions

View File

@ -133,7 +133,9 @@ func findTheme (name string, trail []string, warn bool, path ...string) (Theme,
for index, directory := range theme.Directories {
directory.Paths = make([]string, len(instances))
for pathIndex, path := range directory.Paths {
directory.Paths[pathIndex] = filepath.Join(path, directory.Name)
directory.Paths[pathIndex] = filepath.Join (
instances[pathIndex],
path, directory.Name)
}
theme.Directories[index] = directory
}
@ -329,7 +331,8 @@ func (theme Theme) findIconHere (name string, size, scale int, supported ...Icon
if directory.Fits(size, scale) {
for _, path := range directory.Paths {
for _, ty := range supported {
icon, err := parseIcon(filepath.Join(path, ty.Extend(name)))
icon, err := parseIcon(filepath.Join (
path, ty.Extend(name)))
if err == nil { return icon, err }
}
}
@ -344,7 +347,8 @@ func (theme Theme) findIconHere (name string, size, scale int, supported ...Icon
if sizeDistance < minimalDistance {
for _, path := range directory.Paths {
for _, ty := range supported {
iconFilename := filepath.Join(path, ty.Extend(name))
iconFilename := filepath.Join (
path, ty.Extend(name))
if _, err := os.Stat(iconFilename); err == nil {
closestFilename = iconFilename
minimalDistance = sizeDistance