mirror of
https://github.com/gopasspw/gopass.git
synced 2025-12-08 19:24:54 +00:00
This change adds GoDoc comments to many of the public symbols in the `pkg/` directory. It also includes various improvements to the documentation in `README.md` and other markdown files in the `docs/` directory. This is a partial documentation effort, as requested by the user, to get a pull request submitted quickly. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
39 lines
1.2 KiB
Go
39 lines
1.2 KiB
Go
package appdir
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
// UserConfig returns the user's config directory.
|
|
// It uses the APPDATA environment variable on Windows.
|
|
// The GOPASS_HOMEDIR environment variable can be used to override the base path.
|
|
func (a *Appdir) UserConfig() string {
|
|
if hd := os.Getenv("GOPASS_HOMEDIR"); hd != "" {
|
|
return filepath.Join(hd, ".config", a.name)
|
|
}
|
|
|
|
return filepath.Join(os.Getenv("APPDATA"), a.name)
|
|
}
|
|
|
|
// UserCache returns the user's cache directory.
|
|
// It uses the LOCALAPPDATA environment variable on Windows.
|
|
// The GOPASS_HOMEDIR environment variable can be used to override the base path.
|
|
func (a *Appdir) UserCache() string {
|
|
if hd := os.Getenv("GOPASS_HOMEDIR"); hd != "" {
|
|
return filepath.Join(hd, ".cache", a.name)
|
|
}
|
|
|
|
return filepath.Join(os.Getenv("LOCALAPPDATA"), a.name)
|
|
}
|
|
|
|
// UserData returns the user's data directory.
|
|
// It uses the LOCALAPPDATA environment variable on Windows.
|
|
// The GOPASS_HOMEDIR environment variable can be used to override the base path.
|
|
func (a *Appdir) UserData() string {
|
|
if hd := os.Getenv("GOPASS_HOMEDIR"); hd != "" {
|
|
return filepath.Join(hd, ".local", "share", a.name)
|
|
}
|
|
return filepath.Join(os.Getenv("LOCALAPPDATA"), a.name)
|
|
}
|