mirror of https://gitee.com/answerdev/answer.git
18 lines
313 B
Go
18 lines
313 B
Go
package dir
|
|
|
|
import "os"
|
|
|
|
func CreateDirIfNotExist(path string) error {
|
|
return os.MkdirAll(path, os.ModePerm)
|
|
}
|
|
|
|
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()
|
|
}
|