@@ -421,7 +421,8 @@ fn cmd_build(
421421}
422422
423423fn find_latest_binary ( ) -> Result < PathBuf , Error > {
424- let dir = PathBuf :: from ( "target/piano/debug" ) ;
424+ let project = find_project_root ( & std:: env:: current_dir ( ) ?) . map_err ( |_| Error :: NoBinary ) ?;
425+ let dir = project. join ( "target/piano/debug" ) ;
425426 if !dir. is_dir ( ) {
426427 return Err ( Error :: NoBinary ) ;
427428 }
@@ -650,9 +651,10 @@ fn default_runs_dir() -> Result<PathBuf, Error> {
650651 if let Ok ( dir) = std:: env:: var ( "PIANO_RUNS_DIR" ) {
651652 return Ok ( PathBuf :: from ( dir) ) ;
652653 }
653- let local = PathBuf :: from ( "target/piano/runs" ) ;
654+ let project = find_project_root ( & std:: env:: current_dir ( ) ?) . map_err ( |_| Error :: NoRuns ) ?;
655+ let local = project. join ( "target/piano/runs" ) ;
654656 if local. is_dir ( ) {
655- return Ok ( std :: fs :: canonicalize ( local) ? ) ;
657+ return Ok ( local) ;
656658 }
657659 Err ( Error :: NoRuns )
658660}
@@ -661,15 +663,16 @@ fn default_tags_dir() -> Result<PathBuf, Error> {
661663 if let Ok ( dir) = std:: env:: var ( "PIANO_TAGS_DIR" ) {
662664 return Ok ( PathBuf :: from ( dir) ) ;
663665 }
664- let local = PathBuf :: from ( "target/piano/tags" ) ;
666+ let project = find_project_root ( & std:: env:: current_dir ( ) ?) . map_err ( |_| Error :: NoRuns ) ?;
667+ let local = project. join ( "target/piano/tags" ) ;
665668 if local. is_dir ( ) {
666- return Ok ( std :: fs :: canonicalize ( local) ? ) ;
669+ return Ok ( local) ;
667670 }
668671 // Auto-create tags dir if runs exist (tags live alongside runs)
669- let runs_local = PathBuf :: from ( "target/piano/runs" ) ;
672+ let runs_local = project . join ( "target/piano/runs" ) ;
670673 if runs_local. is_dir ( ) {
671674 std:: fs:: create_dir_all ( & local) ?;
672- return Ok ( std :: fs :: canonicalize ( local) ? ) ;
675+ return Ok ( local) ;
673676 }
674677 Err ( Error :: NoRuns )
675678}
0 commit comments