diff --git a/ui/theme/theme.go b/ui/theme/theme.go index 1f273728..41f1bc86 100644 --- a/ui/theme/theme.go +++ b/ui/theme/theme.go @@ -205,11 +205,24 @@ func (m *MyTheme) Icon(name fyne.ThemeIconName) fyne.Resource { // Returns a map [themeFileName] -> displayName func (m *MyTheme) ListThemeFiles() map[string]string { - files, _ := filepath.Glob(m.themeFileDir + "/*.toml") + // Use filepath.Join to create a cross-platform file path + pattern := filepath.Join(m.themeFileDir, "/*.toml") + files, err := filepath.Glob(pattern) + if err != nil { + log.Fatalf("Failed to glob files: %v", err) + } + result := make(map[string]string) - for _, filepath := range files { - if themeFile, err := ReadThemeFile(filepath); err == nil { - result[path.Base(filepath)] = themeFile.SupersonicTheme.Name + for _, filePath := range files { + // Clean the path to avoid issues with slashes + cleanPath := filepath.Clean(filePath) + log.Printf("Trying to read theme file: %s", cleanPath) + + // Now read the theme file, using the cleaned path + if themeFile, err := ReadThemeFile(cleanPath); err == nil { + result[filepath.Base(cleanPath)] = themeFile.SupersonicTheme.Name + } else { + log.Printf("Failed to load theme file: %s, error: %v", cleanPath, err) } } return result