(pattern: string)
| 1239 | } |
| 1240 | |
| 1241 | function splitGlobPattern(pattern: string): { directory: string; relativePattern?: string } { |
| 1242 | const normalized = pattern.startsWith("/") ? pattern : `/workspace/${pattern}`; |
| 1243 | const wildcard = firstWildcardIndex(normalized); |
| 1244 | if (wildcard === -1) { |
| 1245 | return { directory: dirname(normalized), relativePattern: basename(normalized) }; |
| 1246 | } |
| 1247 | const slash = normalized.lastIndexOf("/", wildcard); |
| 1248 | const directory = slash <= 0 ? "/" : normalized.slice(0, slash); |
| 1249 | const relativePattern = normalized.slice(slash + 1); |
| 1250 | return { directory, relativePattern }; |
| 1251 | } |
| 1252 | |
| 1253 | function firstWildcardIndex(pattern: string): number { |
| 1254 | const star = pattern.indexOf("*"); |
no test coverage detected