Merge pull request #28 from yosssi/fix-config-validate

Fix `*Config.validate` method not to make a directory when the `-o` flag's path does not have a directory.
pull/4/head
jimt 2014-05-10 19:59:02 +02:00
commit ab3c8e2995
1 changed files with 5 additions and 3 deletions

View File

@ -179,10 +179,12 @@ func (c *Config) validate() error {
// File does not exist. This is fine, just make
// sure the directory it is to be in exists.
dir, _ := filepath.Split(c.Output)
err = os.MkdirAll(dir, 0744)
if dir != "" {
err = os.MkdirAll(dir, 0744)
if err != nil {
return fmt.Errorf("Create output directory: %v", err)
if err != nil {
return fmt.Errorf("Create output directory: %v", err)
}
}
}