| 505 | } |
| 506 | |
| 507 | fn find_up(target: &str, start: &Path, stop: &Path) -> Vec<PathBuf> { |
| 508 | let mut current = normalize_existing_path(start); |
| 509 | let stop = normalize_existing_path(stop); |
| 510 | let mut result = Vec::new(); |
| 511 | |
| 512 | loop { |
| 513 | let candidate = current.join(target); |
| 514 | if candidate.exists() { |
| 515 | result.push(candidate); |
| 516 | } |
| 517 | if current == stop { |
| 518 | break; |
| 519 | } |
| 520 | let Some(parent) = current.parent() else { |
| 521 | break; |
| 522 | }; |
| 523 | if parent == current { |
| 524 | break; |
| 525 | } |
| 526 | current = parent.to_path_buf(); |
| 527 | } |
| 528 | |
| 529 | result |
| 530 | } |
| 531 | |
| 532 | /// Get the managed config directory for enterprise deployments. |
| 533 | fn get_managed_config_dir() -> PathBuf { |