added comment to windows filePath check

This commit is contained in:
Antonio Fdez 2016-11-19 22:37:11 +01:00 committed by Jesse Szwedko
parent 341ca93b01
commit f1be59ff3d

View File

@ -81,6 +81,7 @@ func loadDataFrom(filePath string) ([]byte, error) {
}
return ioutil.ReadFile(filePath)
} else if runtime.GOOS == "windows" && strings.Contains(u.String(), "\\") {
// on Windows systems u.Path is always empty, so we need to check the string directly.
if _, notFoundFileErr := os.Stat(filePath); notFoundFileErr != nil {
return nil, fmt.Errorf("Cannot read from file: '%s' because it does not exist.", filePath)
}