Simplify $HOME prefix check

This commit is contained in:
John Gosset 2020-07-31 15:57:33 -04:00 committed by Márk Sági-Kazár
parent ce534045f9
commit 3826be3135
1 changed files with 1 additions and 2 deletions

View File

@ -91,8 +91,7 @@ func insensitiviseMap(m map[string]interface{}) {
func absPathify(inPath string) string { func absPathify(inPath string) string {
jww.INFO.Println("Trying to resolve absolute path to", inPath) jww.INFO.Println("Trying to resolve absolute path to", inPath)
if strings.HasPrefix(inPath, "$HOME") && if inPath == "$HOME" || strings.HasPrefix(inPath, "$HOME"+string(os.PathSeparator)) {
(len(inPath) == 5 || inPath[5] == os.PathSeparator) {
inPath = userHomeDir() + inPath[5:] inPath = userHomeDir() + inPath[5:]
} }