init
This commit is contained in:
35
utils/dir.go
Normal file
35
utils/dir.go
Normal file
@@ -0,0 +1,35 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user