engine/utils/dir.go

36 lines
467 B
Go
Raw Normal View History

2024-02-11 01:31:01 +08:00
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
}