Skip to content
This repository was archived by the owner on Feb 27, 2018. It is now read-only.
Merged
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
12 changes: 9 additions & 3 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ func getCfgDir(name string) (string, error) {

// *nix
if home := os.Getenv("HOME"); home != "" {
return filepath.Join(home, name), nil
dir := filepath.Join(home, name)
if _, err := os.Stat(dir); err == nil {
return dir, nil
}
}

// Windows
Expand All @@ -61,15 +64,18 @@ func getCfgDir(name string) (string, error) {
"USERPROFILE",
} {
if val := os.Getenv(env); val != "" {
return filepath.Join(val, "boot2docker"), nil
dir := filepath.Join(val, "boot2docker")
if _, err := os.Stat(dir); err == nil {
return dir, nil
}
}
}
// Fallback to current working directory as a last resort
cwd, err := os.Getwd()
if err != nil {
return "", err
}
return filepath.Join(cwd, name), nil
return cwd, nil
}

// Read configuration from both profile and flags. Flags override profile.
Expand Down