Skip to content

Commit

Permalink
Simplify $HOME prefix check
Browse files Browse the repository at this point in the history
  • Loading branch information
qjcg authored and sagikazarmark committed Jul 31, 2020
1 parent ce53404 commit 3826be3
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions util.go
Expand Up @@ -91,8 +91,7 @@ func insensitiviseMap(m map[string]interface{}) {
func absPathify(inPath string) string {
jww.INFO.Println("Trying to resolve absolute path to", inPath)

if strings.HasPrefix(inPath, "$HOME") &&
(len(inPath) == 5 || inPath[5] == os.PathSeparator) {
if inPath == "$HOME" || strings.HasPrefix(inPath, "$HOME"+string(os.PathSeparator)) {
inPath = userHomeDir() + inPath[5:]
}

Expand Down

0 comments on commit 3826be3

Please sign in to comment.