| 99 | } |
| 100 | |
| 101 | func resolveScanRoots(root, subPath string) []string { |
| 102 | if subPath == "" { |
| 103 | return []string{root} |
| 104 | } |
| 105 | var roots []string |
| 106 | for _, sp := range strings.Split(subPath, "|") { |
| 107 | sp = strings.TrimSpace(strings.Trim(sp, "/")) |
| 108 | if sp == "" { |
| 109 | roots = append(roots, root) |
| 110 | continue |
| 111 | } |
| 112 | candidate := filepath.Join(root, sp) |
| 113 | if _, err := os.Stat(candidate); err == nil { |
| 114 | roots = append(roots, candidate) |
| 115 | } |
| 116 | } |
| 117 | if len(roots) == 0 { |
| 118 | roots = append(roots, root) |
| 119 | } |
| 120 | return roots |
| 121 | } |
| 122 | |
| 123 | func resourceFromFile(root, p, base string, kind entities.Kind) (DiscoveredResource, bool) { |
| 124 | switch kind { |