35 lines
690 B
Go
35 lines
690 B
Go
//+build !darwin
|
|
|
|
package main
|
|
|
|
import (
|
|
"os"
|
|
"os/user"
|
|
"path"
|
|
|
|
"golang.org/x/image/font/gofont/goregular"
|
|
"golang.org/x/image/font/sfnt"
|
|
)
|
|
|
|
func init() {
|
|
var err error
|
|
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")
|
|
}
|
|
}
|
|
}
|