Files

41 lines
832 B
Go

//go:build linux || darwin
package desktop
import (
"fmt"
"os"
"os/exec"
"runtime"
)
func unprotect([]byte) ([]byte, error) {
return nil, fmt.Errorf("legacy DPAPI keys require their original Windows account; use migrate-key with the original key")
}
func checkDatabaseFile(path string) error {
info, err := os.Stat(path)
if err != nil {
return err
}
if info.Mode().Perm()&0077 != 0 {
return fmt.Errorf("database permissions must exclude group and other users: %s", path)
}
return nil
}
func restrictDatabaseFile(file *os.File) error { return file.Chmod(0600) }
func OpenBrowser(address string) error {
command := "xdg-open"
if runtime.GOOS == "darwin" {
command = "open"
}
process := exec.Command(command, address)
if err := process.Start(); err != nil {
return err
}
go process.Wait()
return nil
}