open-consul/lib/path.go

15 lines
220 B
Go
Raw Normal View History

2017-01-18 06:20:11 +00:00
package lib
import (
"os"
"path/filepath"
)
// EnsurePath is used to make sure a path exists
func EnsurePath(path string, dir bool) error {
if !dir {
path = filepath.Dir(path)
}
return os.MkdirAll(path, 0755)
}