-
Notifications
You must be signed in to change notification settings - Fork 0
/
dirs.go
58 lines (44 loc) · 1.22 KB
/
dirs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package main
import (
"fmt"
"os"
"strings"
)
var skipDirs []string
// DirExists: Returns true if the given directory exists, false if it does not
func DirExists(_dirPath string) bool {
dirExists := false
if DEBUG == true {
fmt.Println(fmt.Sprintf(UI_Arguments, GetFunctionName()), "_dirPath: ", _dirPath)
}
if len(_dirPath) > 0 {
_, err := os.Stat(_dirPath)
if err == nil {
dirExists = true
}
} else {
fmt.Println(fmt.Sprintf(UI_ParameterInvalid, GetFunctionName()), "_dirPath: ", _dirPath)
}
return dirExists
}
// SetSkipDirs: Extract and set list of directories to skip
func SetSkipDirs(_dirs string) {
if DEBUG == true {
fmt.Println(fmt.Sprintf(UI_Arguments, GetFunctionName()), "_dirs: ", _dirs)
}
if len(_dirs) > 0 {
splitDirs := strings.Split(_dirs, ",")
skipDirs = make([]string, len(splitDirs))
if splitDirs != nil && len(splitDirs) > 0 {
splitDirs2 := strings.Split(splitDirs[0], "=")
if splitDirs2 != nil && len(splitDirs2) > 0 {
skipDirs[0] = splitDirs2[1]
for counter := 1; counter != len(splitDirs); counter++ {
skipDirs[counter] = splitDirs[counter]
}
}
}
} else {
fmt.Println(fmt.Sprintf(UI_ParameterInvalid, GetFunctionName()), "_dirs: ", _dirs)
}
}