Prefer active realworld compiler
- SHA
d9e500e466bd7d45f5c30fb20bb939c164db6b00- Parents
-
0dd44db - Tree
deda014
d9e500e
d9e500e466bd7d45f5c30fb20bb939c164db6b000dd44db
deda014| Status | File | + | - |
|---|---|---|---|
| M |
tests/sprint29_audit_realworld.rs
|
24 | 2 |
tests/sprint29_audit_realworld.rsmodified@@ -21,9 +21,31 @@ fn capture_text(request: CaptureRequest, stage: Stage) -> String { | ||
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | +fn candidate_target_dirs() -> Vec<PathBuf> { | |
| 25 | + let mut dirs = Vec::new(); | |
| 26 | + if let Ok(exe) = std::env::current_exe() { | |
| 27 | + for ancestor in exe.ancestors() { | |
| 28 | + let Some(name) = ancestor.file_name().and_then(|n| n.to_str()) else { | |
| 29 | + continue; | |
| 30 | + }; | |
| 31 | + if matches!(name, "debug" | "release") { | |
| 32 | + dirs.push(ancestor.to_path_buf()); | |
| 33 | + break; | |
| 34 | + } | |
| 35 | + } | |
| 36 | + } | |
| 37 | + for dir in ["target/release", "target/debug"] { | |
| 38 | + let candidate = PathBuf::from(dir); | |
| 39 | + if !dirs.iter().any(|existing| existing == &candidate) { | |
| 40 | + dirs.push(candidate); | |
| 41 | + } | |
| 42 | + } | |
| 43 | + dirs | |
| 44 | +} | |
| 45 | + | |
| 24 | 46 | fn find_compiler() -> PathBuf { |
| 25 | - for candidate in ["target/debug/armfortas", "target/release/armfortas"] { | |
| 26 | - let path = PathBuf::from(candidate); | |
| 47 | + for dir in candidate_target_dirs() { | |
| 48 | + let path = dir.join("armfortas"); | |
| 27 | 49 | if path.exists() { |
| 28 | 50 | return path; |
| 29 | 51 | } |