2019-09-06 11:43:14 -04:00
|
|
|
//+build !darwin
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
2019-11-20 14:30:43 -05:00
|
|
|
"git.wow.st/gmp/passgo"
|
|
|
|
"gioui.org/app"
|
2019-09-06 11:43:14 -04:00
|
|
|
)
|
|
|
|
|
2019-11-20 15:48:56 -05:00
|
|
|
var (
|
|
|
|
noidLabelText = "Enter a GPG key ID above"
|
|
|
|
)
|
|
|
|
|
2019-09-06 11:43:14 -04:00
|
|
|
func init() {
|
2019-09-19 17:28:15 -04:00
|
|
|
log(Info, "Android start")
|
2019-11-20 14:30:43 -05:00
|
|
|
// Use a larger font on Android
|
|
|
|
fontSize = 24
|
|
|
|
}
|
|
|
|
|
|
|
|
func initPgp(w *app.Window) {
|
|
|
|
passgo.InitPgp(w)
|
|
|
|
}
|
|
|
|
|
|
|
|
func getConfDir() (string, error) {
|
|
|
|
ret, err := app.DataDir()
|
2019-09-06 11:43:14 -04:00
|
|
|
if err != nil {
|
2019-11-20 14:30:43 -05:00
|
|
|
log(Error, "Cannot get data directory:", err)
|
|
|
|
return "", err
|
2019-09-06 11:43:14 -04:00
|
|
|
}
|
2019-11-20 14:30:43 -05:00
|
|
|
if _, err := os.Stat(ret); os.IsNotExist(err) {
|
|
|
|
err = os.MkdirAll(ret, 0700)
|
2019-09-06 11:43:14 -04:00
|
|
|
if err != nil {
|
2019-11-20 14:30:43 -05:00
|
|
|
log(Error, "Cannot create configuration directory ", ret)
|
|
|
|
return "", err
|
2019-09-06 11:43:14 -04:00
|
|
|
} else {
|
|
|
|
log(Info, "Configuration directory created")
|
2019-11-20 14:30:43 -05:00
|
|
|
return ret, nil
|
2019-09-06 11:43:14 -04:00
|
|
|
}
|
2019-09-19 17:28:15 -04:00
|
|
|
} else {
|
|
|
|
log(Info, "Configuration directory found")
|
2019-11-20 14:30:43 -05:00
|
|
|
return ret, nil
|
2019-09-06 11:43:14 -04:00
|
|
|
}
|
|
|
|
}
|