mirror of
https://github.com/sst/opencode.git
synced 2025-07-07 16:14:59 +00:00
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:
parent
eb38d11a68
commit
373e80c8ff
1 changed files with 2 additions and 1 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
"fmt"
|
||||
"image/color"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
|
@ -42,7 +43,7 @@ func LoadThemesFromJSON() error {
|
|||
continue
|
||||
}
|
||||
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 {
|
||||
return fmt.Errorf("failed to read theme file %s: %w", entry.Name(), err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue