Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const (

// Only used on Windows
PATHEXT = "PATHEXT"
USERPROFILE = "USERPROFILE"

// Only used in tests
ELVISH_TEST_TIME_SCALE = "ELVISH_TEST_TIME_SCALE"
Expand Down
11 changes: 7 additions & 4 deletions pkg/fsutil/gethome.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ func GetHome(uname string) (string, error) {
if uname == "" {
// Use $HOME as override if we are looking for the home of the current
// variable.
home := os.Getenv(env.HOME)
if home != "" {
if runtime.GOOS == "windows" {
if runtime.GOOS == "windows" {
home := os.Getenv(env.USERPROFILE)
if home != "" {
return strings.TrimRight(home, "/\\"), nil
} else {
}
} else {
home := os.Getenv(env.HOME)
if home != "" {
return strings.TrimRight(home, "/"), nil
}
}
Expand Down