70 lines
1.3 KiB
Go
70 lines
1.3 KiB
Go
//+build darwin
|
|
|
|
package main
|
|
|
|
import (
|
|
"os"
|
|
"os/user"
|
|
"path"
|
|
|
|
"gioui.org/app"
|
|
)
|
|
|
|
var (
|
|
noidLabelText = "No GPG ids available. Please create a private key or enter a key ID above"
|
|
)
|
|
|
|
/*func setFont() error {
|
|
f, err := os.Open("/System/Library/Fonts/AppleSDGothicNeo.ttc")
|
|
if err != nil {
|
|
log(Info, "Cannot open system font.")
|
|
return err
|
|
|
|
}
|
|
collection, err := sfnt.ParseCollectionReaderAt(f)
|
|
if err != nil {
|
|
log(Info, "Cannot parse system font.")
|
|
return err
|
|
}
|
|
regular, err = collection.Font(0)
|
|
if err != nil {
|
|
log(Info, "Cannot access first font in collection.")
|
|
return err
|
|
}
|
|
return nil
|
|
}*/
|
|
|
|
func init() {
|
|
fontSize = 16
|
|
//err := setFont()
|
|
//if err != nil {
|
|
// regular, err = sfnt.Parse(goregular.TTF)
|
|
// if err != nil {
|
|
// log(Fatal, "Cannot parse default font: ", err)
|
|
// }
|
|
//}
|
|
}
|
|
|
|
func initPgp(w *app.Window) {
|
|
}
|
|
|
|
func getConfDir() (string, error) {
|
|
usr, err := user.Current()
|
|
if err != nil {
|
|
log(Error, "Cannot get current user: ", err)
|
|
return "", err
|
|
}
|
|
ret := path.Join(usr.HomeDir, ".config/passgo")
|
|
if _, err := os.Stat(ret); os.IsNotExist(err) {
|
|
err = os.MkdirAll(ret, 0700)
|
|
if err != nil {
|
|
log(Info, "Cannot create configuration directory ", confDir)
|
|
return "", err
|
|
} else {
|
|
log(Info, "Configuration directory created")
|
|
return ret, nil
|
|
}
|
|
}
|
|
return ret, nil
|
|
}
|