From 2d277c78b0d98a04c1b544d727e9f914697f0482 Mon Sep 17 00:00:00 2001 From: Chris Laprun Date: Wed, 18 Sep 2019 21:03:06 +0200 Subject: [PATCH] feat: add IsValidDir validation --- pkg/validation/validation.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/validation/validation.go b/pkg/validation/validation.go index ae5a43a..a61d1f7 100644 --- a/pkg/validation/validation.go +++ b/pkg/validation/validation.go @@ -31,6 +31,14 @@ func CheckFileExist(fileName string) bool { return true } +func IsValidDir(fileName string) bool { + info, err := os.Stat(fileName) + if os.IsNotExist(err) || !info.IsDir() { + return false + } + return true +} + func IsValid(value string, validValues []string) bool { for _, v := range validValues { if value == v {