diff --git a/utils.go b/utils.go index 0d5ef38..79b53c6 100644 --- a/utils.go +++ b/utils.go @@ -170,6 +170,19 @@ func CheckExists(filePath string, allowDir bool) bool { 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 - func SliceIndex(limit int, predicate func(idx int) bool) int { for i := 0; i < limit; i++ {