Fix *Config.validate
method not to make a directory when the -o
flag's path does not have a directory.
This commit is contained in:
parent
2ebf002fb5
commit
ca7033b19a
|
@ -179,12 +179,14 @@ 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)
|
||||
if dir != "" {
|
||||
err = os.MkdirAll(dir, 0744)
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("Create output directory: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if stat != nil && stat.IsDir() {
|
||||
return fmt.Errorf("Output path is a directory.")
|
||||
|
|
Loading…
Reference in New Issue
Block a user