passgo/cmd/passgo-gui/impl_non_darwin.go

39 lines
720 B
Go
Raw Normal View History

2019-09-06 11:43:14 -04:00
//+build !darwin
package main
import (
"os"
"os/user"
"path"
"golang.org/x/image/font/gofont/goregular"
"golang.org/x/image/font/sfnt"
)
var (
regular *sfnt.Font
confDir string
)
func init() {
regular, err = sfnt.Parse(goregular.TTF)
if err != nil {
log(Fatal, "Cannot parse default font: ", err)
}
usr, err := user.Current()
if err != nil {
log(Fatal, "Cannot get current user: ", err)
}
confDir = path.Join(usr.HomeDir, ".config/passgo")
if _, err := os.Stat(confDir); os.IsNotExist(err) {
err = os.MkdirAll(confDir, 0700)
if err != nil {
log(Info, "Cannot create configuration directory ", confDir)
log(Fatal, err)
} else {
log(Info, "Configuration directory created")
}
}
}