feat(cli): improve error handling for missing plugin dir

This commit is contained in:
bergquist
2016-03-11 14:11:25 +01:00
parent 8da702c2e7
commit f5bb2b11e5
2 changed files with 10 additions and 1 deletions
@@ -28,7 +28,15 @@ func validateInput(c CommandLine, pluginFolder string) error {
}
fileInfo, err := os.Stat(pluginDir)
if err != nil && !fileInfo.IsDir() {
if err != nil {
if err = os.MkdirAll(pluginDir, os.ModePerm); err != nil {
return errors.New("path is not a directory")
}
return nil
}
if !fileInfo.IsDir() {
return errors.New("path is not a directory")
}