Skip to content

Commit

Permalink
Redid order of file exists check for sanity
Browse files Browse the repository at this point in the history
  • Loading branch information
codepope committed Sep 17, 2020
1 parent 38aa8e6 commit b455d86
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions flyctl/app_config.go
Expand Up @@ -258,18 +258,19 @@ func ResolveConfigFileFromPath(p string) (string, error) {
// Is this a bare directory path? Stat the path
pd, err := os.Stat(p)

if err == os.ErrNotExist {
return path.Join(p, defaultConfigFileName), nil
} else if err != nil {
if err != nil {
if os.IsNotExist(err) {
return p, nil
}
return "", err
}

// Ok, something exists. Is it a file - yes? return the path
if !pd.IsDir() {
return p, nil
if pd.IsDir() {
return path.Join(p, defaultConfigFileName), nil
}

return path.Join(p, defaultConfigFileName), nil
return p, nil
}

func ConfigFormatFromPath(p string) ConfigFormat {
Expand Down

0 comments on commit b455d86

Please sign in to comment.