IsVersionPath checks if a path matches a version directory pattern.
(relPath, versionPattern string)
| 268 | |
| 269 | // IsVersionPath checks if a path matches a version directory pattern. |
| 270 | func IsVersionPath(relPath, versionPattern string) bool { |
| 271 | if versionPattern == "" { |
| 272 | return false |
| 273 | } |
| 274 | matched, _ := filepath.Match(versionPattern, relPath) |
| 275 | if matched { |
| 276 | return true |
| 277 | } |
| 278 | // Check if any parent directory matches |
| 279 | parts := strings.Split(filepath.ToSlash(relPath), "/") |
| 280 | for i := range parts { |
| 281 | partial := strings.Join(parts[:i+1], "/") |
| 282 | if m, _ := filepath.Match(versionPattern, partial); m { |
| 283 | return true |
| 284 | } |
| 285 | } |
| 286 | return false |
| 287 | } |
| 288 | |
| 289 | // splitKeywords splits a string on common separators. |
| 290 | func splitKeywords(s string) []string { |