(path string, paths []string, fullPath bool, rootPath string)
| 100 | } |
| 101 | |
| 102 | func getNewPathsFromDir(path string, paths []string, fullPath bool, rootPath string) []string { |
| 103 | _, e := os.Stat(path) |
| 104 | if os.IsNotExist(e) { |
| 105 | return paths |
| 106 | } |
| 107 | |
| 108 | _ = filepath.Walk(path, func(path string, info os.FileInfo, err error) error { |
| 109 | matched, _ := regexp.MatchString(consts.RegexArtifacts, info.Name()) |
| 110 | if matched { |
| 111 | dir, _ := filepath.Split(path) |
| 112 | if !fullPath { |
| 113 | dir, _ = filepath.Rel(rootPath, dir) |
| 114 | } |
| 115 | if !utils.Contains(paths, dir) { |
| 116 | paths = append(paths, dir) |
| 117 | } |
| 118 | // add ..\ prefixed path -> @MeroFuruya fix #146 |
| 119 | prefixedPath := "..\\" + dir |
| 120 | if !utils.Contains(paths, prefixedPath) { |
| 121 | paths = append(paths, prefixedPath) |
| 122 | } |
| 123 | } |
| 124 | return nil |
| 125 | }) |
| 126 | |
| 127 | for _, path := range getDefaultPath(fullPath, rootPath) { |
| 128 | if !utils.Contains(paths, path) { |
| 129 | paths = append(paths, path) |
| 130 | } |
| 131 | // prevent variables from being prefixed |
| 132 | if !strings.HasPrefix(path, "$") { |
| 133 | // add ..\ prefixed path -> @MeroFuruya fix #146 |
| 134 | prefixedPath := "..\\" + path |
| 135 | if !utils.Contains(paths, prefixedPath) { |
| 136 | paths = append(paths, prefixedPath) |
| 137 | } |
| 138 | } |
| 139 | } |
| 140 | return cleanEmpty(paths) |
| 141 | } |
no test coverage detected