2022-09-27 17:59:05 +08:00
|
|
|
package dir
|
|
|
|
|
|
|
|
import "os"
|
|
|
|
|
2022-10-24 20:26:00 +08:00
|
|
|
func CreateDirIfNotExist(path string) error {
|
|
|
|
return os.MkdirAll(path, os.ModePerm)
|
2022-09-27 17:59:05 +08:00
|
|
|
}
|
2022-10-12 11:14:20 +08:00
|
|
|
|
2022-10-24 20:26:00 +08:00
|
|
|
func CheckDirExist(path string) bool {
|
|
|
|
f, err := os.Stat(path)
|
|
|
|
return err == nil && f.IsDir()
|
|
|
|
}
|
|
|
|
|
|
|
|
func CheckFileExist(path string) bool {
|
|
|
|
f, err := os.Stat(path)
|
|
|
|
return err == nil && !f.IsDir()
|
2022-10-12 11:14:20 +08:00
|
|
|
}
|