updating the mkDir wrapper to be less weird (you'll see what i mean)
This commit is contained in:
parent
044c65b62e
commit
04b81d64d4
13
scribble.go
13
scribble.go
|
@ -12,7 +12,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
const Version = "1.0.2"
|
const Version = "1.0.3"
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|
||||||
|
@ -214,14 +214,9 @@ func (d *Driver) getOrCreateMutex(collection string) sync.Mutex {
|
||||||
func mkDir(d string) (err error) {
|
func mkDir(d string) (err error) {
|
||||||
|
|
||||||
//
|
//
|
||||||
dir, _ := os.Stat(d)
|
if _, err = os.Stat(d); err != nil {
|
||||||
|
return
|
||||||
switch {
|
|
||||||
case dir == nil:
|
|
||||||
err = os.MkdirAll(d, 0755)
|
|
||||||
case !dir.IsDir():
|
|
||||||
err = os.ErrInvalid
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return os.MkdirAll(d, 0755)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue