From 0b9a288af3b49f4c0eb5563e78263aba39cf37ff Mon Sep 17 00:00:00 2001 From: Sebastien Douheret Date: Fri, 11 Aug 2017 10:36:31 +0200 Subject: Add IsDir function. --- golib/filepath.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/golib/filepath.go b/golib/filepath.go index 90424d7..9897163 100644 --- a/golib/filepath.go +++ b/golib/filepath.go @@ -23,6 +23,18 @@ func Exists(path string) bool { return true } +// IsDir returns true when the given path is a directory +func IsDir(path string) bool { + fi, err := os.Stat(path) + if err != nil { + dd + fmt.Printf("SEB %v", path) + return false + } + + return fi.Mode().IsDir() +} + // ResolveEnvVar Resolved environment variable regarding the syntax ${MYVAR} // or $MYVAR following by a slash or a backslash func ResolveEnvVar(s string) (string, error) { -- cgit 1.2.3-korg