mirror of https://github.com/liamg/aminal.git
Fix font loading for home dirs (#309)
* Update fontinfo to v0.1.1 * Fix font loading
This commit is contained in:
parent
e492e6ea90
commit
41f8406484
2
go.mod
2
go.mod
|
@ -7,7 +7,7 @@ require (
|
|||
github.com/d-tsuji/clipboard v0.0.3
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210727001814-0db043d8d5be // indirect
|
||||
github.com/hajimehoshi/ebiten/v2 v2.2.0-alpha.11.0.20210724070913-1706d9436a78
|
||||
github.com/liamg/fontinfo v0.1.1
|
||||
github.com/liamg/fontinfo v0.1.3
|
||||
github.com/mvdan/xurls v1.1.0 // indirect
|
||||
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
|
||||
github.com/spf13/cobra v1.1.3
|
||||
|
|
4
go.sum
4
go.sum
|
@ -198,8 +198,8 @@ github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn
|
|||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/liamg/fontinfo v0.1.1 h1:NoDMyZGdur30O8Z97cBWRTBpTAoD3DQljsRbWPKv/kw=
|
||||
github.com/liamg/fontinfo v0.1.1/go.mod h1:6REdGXLC8yXmxpX31DDwjjzT06g1c7UcvY75AGf9sH4=
|
||||
github.com/liamg/fontinfo v0.1.3 h1:R3b2lEAQNwaNJv1jD8B30SUWHkOmzbk7KpKdLrNx+tk=
|
||||
github.com/liamg/fontinfo v0.1.3/go.mod h1:6REdGXLC8yXmxpX31DDwjjzT06g1c7UcvY75AGf9sH4=
|
||||
github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
|
||||
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
|
||||
github.com/lxn/walk v0.0.0-20191128110447-55ccb3a9f5c1 h1:/QwQcwWVOQXcoNuV9tHx30gQ3q7jCE/rKcGjwzsa5tg=
|
||||
|
|
|
@ -3,6 +3,7 @@ package fontinfo
|
|||
import (
|
||||
"io/fs"
|
||||
"os"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
@ -43,8 +44,17 @@ func Match(matchers ...matcher) ([]Font, error) {
|
|||
var fonts []Font
|
||||
meta := make(map[string]*fontMetadata)
|
||||
|
||||
var home string
|
||||
if usr, _ := user.Current(); usr != nil {
|
||||
home = usr.HomeDir
|
||||
}
|
||||
|
||||
for _, dir := range fontDirs {
|
||||
|
||||
if home != "" && strings.HasPrefix(dir, "~/") {
|
||||
dir = filepath.Join(home, dir[2:])
|
||||
}
|
||||
|
||||
if info, err := os.Stat(dir); os.IsNotExist(err) {
|
||||
continue
|
||||
} else if !info.IsDir() {
|
||||
|
@ -65,7 +75,7 @@ func Match(matchers ...matcher) ([]Font, error) {
|
|||
defer f.Close()
|
||||
metadata, err := readMetadata(f)
|
||||
if err != nil {
|
||||
return err
|
||||
continue
|
||||
}
|
||||
for _, match := range matchers {
|
||||
if !match(metadata) {
|
||||
|
|
|
@ -60,7 +60,7 @@ github.com/hajimehoshi/ebiten/v2/internal/uidriver/mobile
|
|||
github.com/hajimehoshi/ebiten/v2/text
|
||||
# github.com/inconshreveable/mousetrap v1.0.0
|
||||
github.com/inconshreveable/mousetrap
|
||||
# github.com/liamg/fontinfo v0.1.1
|
||||
# github.com/liamg/fontinfo v0.1.3
|
||||
## explicit
|
||||
github.com/liamg/fontinfo
|
||||
# github.com/lxn/walk v0.0.0-20191128110447-55ccb3a9f5c1
|
||||
|
|
Loading…
Reference in New Issue