Merge pull request #1 from fernandezvara/patch-yaml-config-windows
allow to load YAML configuration files on Windows
This commit is contained in:
commit
dda37c45da
@ -78,6 +78,11 @@ func loadDataFrom(filePath string) ([]byte, error) {
|
||||
return nil, fmt.Errorf("Cannot read from file: '%s' because it does not exist.", filePath)
|
||||
}
|
||||
return ioutil.ReadFile(filePath)
|
||||
} else if runtime.GOOS == "windows" && strings.Contains(u.String(), "\\") {
|
||||
if _, notFoundFileErr := os.Stat(filePath); notFoundFileErr != nil {
|
||||
return nil, fmt.Errorf("Cannot read from file: '%s' because it does not exist.", filePath)
|
||||
}
|
||||
return ioutil.ReadFile(filePath)
|
||||
} else {
|
||||
return nil, fmt.Errorf("unable to determine how to load from path %s", filePath)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user