fix(tui): don't use path/filepath for embed

EmbedFS uses '/' always for file paths. It does not support '\' even on
Windows. Make sure we don't give EmbedFS a '\' path on Windows. This
lets the TUI find the theme files, avoiding crashes in various parts of
the code that assume a theme exists.
This commit is contained in:
Matthew Glazar 2025-06-22 18:43:28 -04:00 committed by Dax Raad
parent eb38d11a68
commit 373e80c8ff

View file

@ -6,6 +6,7 @@ import (
"fmt" "fmt"
"image/color" "image/color"
"os" "os"
"path"
"path/filepath" "path/filepath"
"strings" "strings"
@ -42,7 +43,7 @@ func LoadThemesFromJSON() error {
continue continue
} }
themeName := strings.TrimSuffix(entry.Name(), ".json") themeName := strings.TrimSuffix(entry.Name(), ".json")
data, err := themesFS.ReadFile(filepath.Join("themes", entry.Name())) data, err := themesFS.ReadFile(path.Join("themes", entry.Name()))
if err != nil { if err != nil {
return fmt.Errorf("failed to read theme file %s: %w", entry.Name(), err) return fmt.Errorf("failed to read theme file %s: %w", entry.Name(), err)
} }