Skip to content

Commit 63a14bf

Browse files
committed
home: use filepath.FromSlash for windows
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
1 parent 2e9fa51 commit 63a14bf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

home/home_windows.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ package home
88

99
import (
1010
"os"
11+
"path/filepath"
1112
)
1213

1314
// Dir detects and returns the user home directory.
1415
func Dir() string {
1516
// At first, Check the $HOME environment variable
1617
usrHome := os.Getenv("HOME")
1718
if usrHome != "" {
18-
return usrHome
19+
return filepath.FromSlash(usrHome)
1920
}
2021

2122
// TODO(zchee): In Windows OS, which of $HOME and these checks has priority?
@@ -24,5 +25,5 @@ func Dir() string {
2425
usrHome = os.Getenv("HOMEDRIVE") + os.Getenv("HOMEPATH")
2526
}
2627

27-
return usrHome
28+
return filepath.FromSlash(usrHome)
2829
}

0 commit comments

Comments
 (0)