engine/utils/dir.go

36 lines
467 B
Go

package utils
import (
"os"
)
func PathExists(path string) bool {
_, err := os.Stat(path)
if err != nil {
if os.IsExist(err) {
return true
}
return false
}
return true
}
// 创建文件夹
func CreateDir(dirName string) bool {
err := os.Mkdir(dirName, 0755)
if err != nil {
return false
}
return true
}
func GetRunPath() string {
path, _ := os.Executable()
return path
}
func GetCurrentPath() string {
path, _ := os.Getwd()
return path
}