fix(assembler): replace unwrap on root.parent with safe fallback

root.parent().unwrap() at main.rs:45 panicked if AGENT_ROOT pointed at a
filesystem root (e.g. AGENT_ROOT=/). Now falls back to root itself via
.unwrap_or(root.as_path()) so the 'OK  <manifest> → <path>' line just
prints the absolute path in that edge case instead of aborting.
This commit is contained in:
Parfii-bot 2026-04-21 03:05:14 +08:00
parent 16d4b48c77
commit 30cd08b85b

View file

@ -42,7 +42,7 @@ fn main() -> ExitCode {
Ok(out_path) => {
let name = path.file_name().unwrap_or_default().to_string_lossy();
match out_path {
Some(p) => println!("OK {name}{}", relative_to(&p, &root.parent().unwrap())),
Some(p) => println!("OK {name}{}", relative_to(&p, root.parent().unwrap_or(root.as_path()))),
None => println!("OK {name}"),
}
}