add: is dir function

This commit is contained in:
vilet.yy 2021-04-30 17:38:27 +08:00
parent 3a164c4634
commit f4beaae3de
1 changed files with 9 additions and 1 deletions

View File

@ -1,7 +1,7 @@
/*
* @Date: 2021-03-22 10:45:37
* @LastEditors: viletyy
* @LastEditTime: 2021-04-27 16:15:43
* @LastEditTime: 2021-04-29 11:44:54
* @FilePath: /yolk/directory.go
*/
package yolk
@ -22,6 +22,14 @@ func PathExists(path string) (bool, error) {
return false, err
}
func IsDir(f string) bool {
fi, err := os.Stat(f)
if err != nil {
return false
}
return fi.IsDir()
}
func CreateDir(dirs ...string) (err error) {
for _, v := range dirs {
exist, err := PathExists(v)