diff options
author | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-08-11 10:36:31 +0200 |
---|---|---|
committer | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-08-11 10:36:31 +0200 |
commit | 0b9a288af3b49f4c0eb5563e78263aba39cf37ff (patch) | |
tree | 87696d973a76f06323f9018fb876f37289b5179e | |
parent | 8a652414db4d82943a7ae88ff5e3a6c2f587961f (diff) |
Add IsDir function.
-rw-r--r-- | golib/filepath.go | 12 |
1 files changed, 12 insertions, 0 deletions
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) { |