MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / find_up

Function find_up

crates/opencode-config/src/loader.rs:507–530  ·  view source on GitHub ↗
(target: &str, start: &Path, stop: &Path)

Source from the content-addressed store, hash-verified

505}
506
507fn 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.
533fn get_managed_config_dir() -> PathBuf {

Callers 3

load_projectMethod · 0.70
test_find_upFunction · 0.50

Calls 3

normalize_existing_pathFunction · 0.85
newFunction · 0.85
existsMethod · 0.80

Tested by 1

test_find_upFunction · 0.40