@@ -10,13 +10,16 @@ import (
10
10
func (tree * FileTree ) UpdateFiles () error {
11
11
nestedLevel := 0
12
12
for _ , inputPath := range * tree .InputPaths {
13
+
13
14
inputPath = strings .TrimSpace (inputPath )
14
15
file , err := os .Stat (inputPath )
15
16
if err != nil {
16
17
return err
17
18
}
18
19
path := filepath .Join (inputPath , file .Name ())
19
- if file .IsDir () && tree .MaxNestedDir != nestedLevel {
20
+ if file .IsDir () && tree .MaxNestedDir != nestedLevel &&
21
+ tree .IsDirAllowed (path ) {
22
+
20
23
tree .IsDir = true
21
24
nestedLevel_ := nestedLevel + 1
22
25
// . actually means all the dirs and files in curr directory
@@ -30,8 +33,8 @@ func (tree *FileTree) UpdateFiles() error {
30
33
if err != nil {
31
34
return err
32
35
}
33
- } else {
34
- tree .IsFile = true
36
+ } else if tree . IsFileAllowed ( path ) {
37
+ tree .HasFile = true
35
38
if CheckPathHidden (path ) {
36
39
tree .HiddenFilePaths = append (tree .HiddenFilePaths , path )
37
40
} else {
@@ -58,15 +61,17 @@ func (tree *FileTree) iterateDir(basePath *string, nestedLevel int) error {
58
61
}
59
62
for _ , file := range ls {
60
63
path := filepath .Join (* basePath , file .Name ())
61
- if file .IsDir () && tree .MaxNestedDir != nestedLevel {
64
+ if file .IsDir () && tree .MaxNestedDir != nestedLevel &&
65
+ tree .IsDirAllowed (path ) {
66
+
62
67
tree .IsNestedDir = true
63
68
64
69
err := tree .iterateDir (& path , nestedLevel + 1 )
65
70
if err != nil {
66
71
return err
67
72
}
68
- } else {
69
- tree .IsFile = true
73
+ } else if tree . IsFileAllowed ( path ) {
74
+ tree .HasFile = true
70
75
71
76
if CheckPathHidden (path ) {
72
77
tree .HiddenFilePaths = append (tree .HiddenFilePaths , path )
0 commit comments