Skip to content

Commit

Permalink
Fix home env var value for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ameyer-pivotal committed Jul 16, 2019
1 parent 324971b commit 8031614
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package config
import (
"os"
"path/filepath"
"runtime"

"github.com/BurntSushi/toml"
"github.com/pkg/errors"
Expand All @@ -25,7 +26,11 @@ func DefaultConfigPath() string {
func PackHome() string {
packHome := os.Getenv("PACK_HOME")
if packHome == "" {
packHome = filepath.Join(os.Getenv("HOME"), ".pack")
homeEnvVar := "HOME"
if runtime.GOOS == "windows" {
homeEnvVar = "USERPROFILE"
}
packHome = filepath.Join(os.Getenv(homeEnvVar), ".pack")
}
return packHome
}
Expand Down

0 comments on commit 8031614

Please sign in to comment.