@@ -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 }
@@ -622,9 +623,10 @@ fn default_runs_dir() -> Result<PathBuf, Error> {
622623 if let Ok ( dir) = std:: env:: var ( "PIANO_RUNS_DIR" ) {
623624 return Ok ( PathBuf :: from ( dir) ) ;
624625 }
625- let local = PathBuf :: from ( "target/piano/runs" ) ;
626+ let project = find_project_root ( & std:: env:: current_dir ( ) ?) . map_err ( |_| Error :: NoRuns ) ?;
627+ let local = project. join ( "target/piano/runs" ) ;
626628 if local. is_dir ( ) {
627- return Ok ( std :: fs :: canonicalize ( local) ? ) ;
629+ return Ok ( local) ;
628630 }
629631 Err ( Error :: NoRuns )
630632}
@@ -633,15 +635,16 @@ fn default_tags_dir() -> Result<PathBuf, Error> {
633635 if let Ok ( dir) = std:: env:: var ( "PIANO_TAGS_DIR" ) {
634636 return Ok ( PathBuf :: from ( dir) ) ;
635637 }
636- let local = PathBuf :: from ( "target/piano/tags" ) ;
638+ let project = find_project_root ( & std:: env:: current_dir ( ) ?) . map_err ( |_| Error :: NoRuns ) ?;
639+ let local = project. join ( "target/piano/tags" ) ;
637640 if local. is_dir ( ) {
638- return Ok ( std :: fs :: canonicalize ( local) ? ) ;
641+ return Ok ( local) ;
639642 }
640643 // Auto-create tags dir if runs exist (tags live alongside runs)
641- let runs_local = PathBuf :: from ( "target/piano/runs" ) ;
644+ let runs_local = project . join ( "target/piano/runs" ) ;
642645 if runs_local. is_dir ( ) {
643646 std:: fs:: create_dir_all ( & local) ?;
644- return Ok ( std :: fs :: canonicalize ( local) ? ) ;
647+ return Ok ( local) ;
645648 }
646649 Err ( Error :: NoRuns )
647650}
0 commit comments