Using MkdirAll instead of my own logic
authorspf13 <steve.francia@gmail.com>
Fri, 26 Jul 2013 22:10:03 +0000 (18:10 -0400)
committerspf13 <steve.francia@gmail.com>
Fri, 26 Jul 2013 22:10:03 +0000 (18:10 -0400)
hugolib/helpers.go

index 7e2adc22148dc56c034fb5b055a155e6ada2daca..6bda4e3e344cb75d9d6b1d1cdf9da855686105ff 100644 (file)
@@ -19,7 +19,6 @@ import (
        "github.com/kr/pretty"
        "html/template"
        "os"
-       "path/filepath"
        "reflect"
        "regexp"
        "strconv"
@@ -139,24 +138,7 @@ func exists(path string) (bool, error) {
 }
 
 func mkdirIf(path string) error {
-       err := os.Mkdir(path, 0777)
-       if err != nil {
-               if os.IsExist(err) {
-                       return nil
-               }
-               if os.IsNotExist(err) {
-                       parent, _ := filepath.Split(path)
-                       err2 := mkdirIf(parent)
-                       if err2 != nil {
-                               return err2
-                       } else {
-                               return mkdirIf(path)
-                       }
-               }
-               return err
-       }
-
-       return nil
+       return os.MkdirAll(path, 0777)
 }
 
 func Urlize(url string) string {