Skip to content

Commit 372315b

Browse files
committed
pass: make home-dir resolution platform agnostic
Use stdlib's os.UserHomeDir() instead of depending only on $HOME. Note that this does not yet does nss lookups for situations where $HOME / $USERPROFILE is not set. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent c8c415f commit 372315b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pass/pass.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"os"
1414
"os/exec"
1515
"path"
16+
"path/filepath"
1617
"strings"
1718
"sync"
1819

@@ -107,7 +108,8 @@ func getPassDir() string {
107108
if passDir := os.Getenv("PASSWORD_STORE_DIR"); passDir != "" {
108109
return passDir
109110
}
110-
return os.ExpandEnv("$HOME/.password-store")
111+
home, _ := os.UserHomeDir()
112+
return filepath.Join(home, ".password-store")
111113
}
112114

113115
// listPassDir lists all the contents of a directory in the password store.

0 commit comments

Comments
 (0)