feat(font): reload font cache on unix systems

This commit is contained in:
Jan De Dobbeleer 2024-06-10 16:12:07 +02:00 committed by Jan De Dobbeleer
parent 89beb8db68
commit ddd120178d

View file

@ -7,7 +7,11 @@ import (
"bytes" "bytes"
"io" "io"
"path" "path"
"runtime"
"strings" "strings"
"github.com/jandedobbeleer/oh-my-posh/src/platform"
"github.com/jandedobbeleer/oh-my-posh/src/platform/cmd"
) )
func contains[S ~[]E, E comparable](s S, e E) bool { func contains[S ~[]E, E comparable](s S, e E) bool {
@ -69,5 +73,10 @@ func InstallZIP(data []byte, user bool) ([]string, error) {
} }
} }
// Update the font cache when installing fonts on Linux
if runtime.GOOS == platform.LINUX || runtime.GOOS == platform.DARWIN {
_, _ = cmd.Run("fc-cache", "-f")
}
return families, nil return families, nil
} }