gopass/pkg/appdir/appdir.go
Dominik Schulz 16c071a780
Enable golangci-lint on push and pr (#2158)
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-03-24 21:58:53 +01:00

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
}