app/util/util.go

22 lines
323 B
Go
Raw Permalink Normal View History

2021-12-16 04:11:33 +00:00
package util
import (
"os"
"path/filepath"
)
func Mkdir(args ...interface{}) error {
var path string
var mode os.FileMode
mode = 0755
for _, arg := range args {
switch arg := arg.(type) {
case string:
path = filepath.Join(path, arg)
case os.FileMode:
mode = arg
}
}
return os.MkdirAll(path, mode)
}