@@ -150,6 +150,13 @@ def _write_scenario(path: Path, runtime_dir_rel: str) -> None:
150150 ET .ElementTree (root ).write (path , encoding = "utf-8" , xml_declaration = True )
151151
152152
153+ def _path_for_imiv_output (path : Path , run_cwd : Path ) -> str :
154+ try :
155+ return os .path .relpath (path , run_cwd )
156+ except ValueError :
157+ return str (path )
158+
159+
153160def _image_crop_rect (layout_path : Path ) -> tuple [int , int , int , int ]:
154161 data = json .loads (layout_path .read_text (encoding = "utf-8" ))
155162 image_window = None
@@ -371,7 +378,9 @@ def main() -> int:
371378 _build_fixture (oiiotool , image_path )
372379
373380 scenario_path = out_dir / "sampling.scenario.xml"
374- _write_scenario (scenario_path , runtime_dir_rel = "runtime" )
381+ runtime_dir = out_dir / "runtime"
382+ runtime_dir_rel = _path_for_imiv_output (runtime_dir , cwd )
383+ _write_scenario (scenario_path , runtime_dir_rel = runtime_dir_rel )
375384
376385 log_path = out_dir / "sampling.log"
377386 cmd = [
@@ -402,7 +411,6 @@ def main() -> int:
402411 print (f"error: runner exited with code { proc .returncode } " , file = sys .stderr )
403412 return 1
404413
405- runtime_dir = out_dir / "runtime"
406414 nearest_screenshot = runtime_dir / "nearest.png"
407415 nearest_layout = runtime_dir / "nearest.layout.json"
408416 linear_screenshot = runtime_dir / "linear.png"
0 commit comments