fortrangoingonforty/armfortas / d9e500e

Browse files

Prefer active realworld compiler

Authored by espadonne
SHA
d9e500e466bd7d45f5c30fb20bb939c164db6b00
Parents
0dd44db
Tree
deda014

1 changed file

StatusFile+-
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 {
2121
     }
2222
 }
2323
 
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
+
2446
 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");
2749
         if path.exists() {
2850
             return path;
2951
         }