29 lines
387 B
Go
29 lines
387 B
Go
package utils
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
)
|
|
|
|
const (
|
|
MkdirMode = 0770
|
|
)
|
|
|
|
func Mkdir(path ...string) error {
|
|
joined := filepath.Join(path...)
|
|
|
|
return os.MkdirAll(joined, MkdirMode)
|
|
}
|
|
|
|
func CleanFileName(path string) (name string, ext string) {
|
|
|
|
name = filepath.Base(path)
|
|
ext = filepath.Ext(name)
|
|
if len(ext) > 0 {
|
|
name = strings.Split(name, ".")[0]
|
|
}
|
|
|
|
return
|
|
}
|