Skip to content

Commit

Permalink
compose resolved path with getent
Browse files Browse the repository at this point in the history
  • Loading branch information
hellt committed Jun 29, 2023
1 parent ac90844 commit e89b80a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion utils/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ func ExpandHome(p string) string {
homedir := lookupUserHomeDirViaGetent(userId)
if homedir != "" {
log.Debugf("user home dir %v found using getent command", homedir)
return homedir
p = strings.Replace(p, "~", homedir, 1)
return p
}
// fallback to current user home dir if getent command fails
p = strings.Replace(p, "~", curUserHomeDir, 1)
Expand Down

0 comments on commit e89b80a

Please sign in to comment.