Using MkdirAll instead of my own logic
This commit is contained in:
parent
7ab28c564f
commit
736677a21d
1 changed files with 1 additions and 19 deletions
|
@ -19,7 +19,6 @@ import (
|
||||||
"github.com/kr/pretty"
|
"github.com/kr/pretty"
|
||||||
"html/template"
|
"html/template"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -139,24 +138,7 @@ func exists(path string) (bool, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func mkdirIf(path string) error {
|
func mkdirIf(path string) error {
|
||||||
err := os.Mkdir(path, 0777)
|
return os.MkdirAll(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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Urlize(url string) string {
|
func Urlize(url string) string {
|
||||||
|
|
Loading…
Add table
Reference in a new issue