mirror of
https://github.com/gopasspw/gopass.git
synced 2025-12-08 19:24:54 +00:00
30 lines
622 B
Go
30 lines
622 B
Go
// Package appdir implements a customized lookup pattern for application paths
|
|
// like config, cache and data dirs. On Linux this uses the XDG specification,
|
|
// on MacOS and Windows the platform defaults.
|
|
package appdir
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/gopasspw/gopass/pkg/debug"
|
|
)
|
|
|
|
// Name is used in the final path of the generated path.
|
|
var Name = "gopass"
|
|
|
|
// UserHome returns the users home dir.
|
|
func UserHome() string {
|
|
if hd := os.Getenv("GOPASS_HOMEDIR"); hd != "" {
|
|
return hd
|
|
}
|
|
|
|
uhd, err := os.UserHomeDir()
|
|
if err != nil {
|
|
debug.Log("failed to detect user home dir: %s", err)
|
|
|
|
return ""
|
|
}
|
|
|
|
return uhd
|
|
}
|