passgo package: modernize for go 1.24; reset store.Empty in GetStore.

- Update to //go:build tags, gofmt, and the android-35 javac template
  in //go:generate.
- GetStore: reset store.Empty when the store directory exists (it was
  only set true when the dir was missing, so a reconfigured store kept
  the stale 'Empty' state and showed the configure button).
- Rebuild PgpConnect.jar (android-35).
This commit is contained in:
Greg Pomerantz 2026-08-21 13:00:03 -04:00
parent edb38a6b85
commit af1b878308
7 changed files with 22 additions and 14 deletions

Binary file not shown.

View File

@ -1,6 +1,8 @@
//+build android
//go:build android
// +build android
//go:generate mkdir -p classes
//go:generate javac -bootclasspath $ANDROID_HOME/platforms/android-29/android.jar -classpath openpgp-api.jar -d classes PgpConnect.java Foo.java
//go:generate javac -nowarn -classpath $ANDROID_HOME/platforms/android-35/android.jar:openpgp-api.jar -d classes PgpConnect.java
//go:generate jar cf PgpConnect.jar -C classes .
//go:generate rm -rf classes
@ -15,8 +17,8 @@ import "C"
import (
"fmt"
"io/ioutil"
"path"
"log"
"path"
"strings"
"sync"
"unsafe"
@ -64,7 +66,7 @@ func connect() {
<-waitch
}
//Clip copies a string to the clipboard
// Clip copies a string to the clipboard
func Clip(x string) {
pgp.Clip(x)
}

View File

@ -1,4 +1,5 @@
//+build darwin
//go:build darwin
// +build darwin
package passgo
@ -119,7 +120,7 @@ func init() {
setAgentInfo()
}
//Clip copies a string to the clipboard
// Clip copies a string to the clipboard
func Clip(x string) {
clip.Set(x)
}

View File

@ -1,4 +1,5 @@
//+build !android,linux
//go:build !android && linux
// +build !android,linux
package passgo
@ -7,7 +8,7 @@ import (
"os/exec"
)
//Clip copies a string to the clipboard
// Clip copies a string to the clipboard
func Clip(x string) {
b := bytes.NewBuffer([]byte(x))
cmd := exec.Command("xclip")

View File

@ -1,4 +1,5 @@
//+build darwin !android,linux
//go:build darwin || (!android && linux)
// +build darwin !android,linux
package passgo

View File

@ -13,11 +13,12 @@ import (
"fmt"
"log"
"runtime"
"unsafe"
"sync"
"unsafe"
)
var theJVM *C.JavaVM
type JNIEnv = C.JNIEnv
func SetJVM(jvm uintptr) {

View File

@ -49,6 +49,8 @@ func GetStore(store *Store) error {
}
if _, err := os.Stat(store.Dir); os.IsNotExist(err) {
store.Empty = true
} else {
store.Empty = false
}
id, err := ioutil.ReadFile(path.Join(store.Dir, ".gpg-id"))
if err != nil {