add isDir func
This commit is contained in:
parent
b266ebeb2d
commit
b019626f03
13
utils.go
13
utils.go
@ -170,6 +170,19 @@ func CheckExists(filePath string, allowDir bool) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsDir -
|
||||||
|
func IsDir(filePath string) bool {
|
||||||
|
filePath = ParsePath(filePath)
|
||||||
|
stat, err := os.Stat(filePath)
|
||||||
|
if err != nil && !os.IsExist(err) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if !stat.IsDir() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
// SliceIndex -
|
// SliceIndex -
|
||||||
func SliceIndex(limit int, predicate func(idx int) bool) int {
|
func SliceIndex(limit int, predicate func(idx int) bool) int {
|
||||||
for i := 0; i < limit; i++ {
|
for i := 0; i < limit; i++ {
|
||||||
|
Loading…
Reference in New Issue
Block a user