|
|
@ -11,6 +11,8 @@ import (
|
|
|
|
"net/http"
|
|
|
|
"net/http"
|
|
|
|
"net/url"
|
|
|
|
"net/url"
|
|
|
|
"os"
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"runtime"
|
|
|
|
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
|
|
|
|
"gopkg.in/urfave/cli.v1"
|
|
|
|
"gopkg.in/urfave/cli.v1"
|
|
|
|
|
|
|
|
|
|
|
@ -78,6 +80,12 @@ func loadDataFrom(filePath string) ([]byte, error) {
|
|
|
|
return nil, fmt.Errorf("Cannot read from file: '%s' because it does not exist.", filePath)
|
|
|
|
return nil, fmt.Errorf("Cannot read from file: '%s' because it does not exist.", filePath)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ioutil.ReadFile(filePath)
|
|
|
|
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)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return ioutil.ReadFile(filePath)
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return nil, fmt.Errorf("unable to determine how to load from path %s", filePath)
|
|
|
|
return nil, fmt.Errorf("unable to determine how to load from path %s", filePath)
|
|
|
|
}
|
|
|
|
}
|
|
|
|