File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -438,10 +438,21 @@ impl StepDescription {
438438 }
439439 }
440440
441- // strip CurDir prefix if present
442- let curdir_path = PathBuf :: from ( "." ) . canonicalize ( ) . unwrap ( ) ;
443- let mut paths: Vec < _ > =
444- paths. iter ( ) . map ( |p| p. strip_prefix ( & curdir_path) . unwrap_or ( p) ) . collect ( ) ;
441+ // Resolve paths to be relative to the builder source directory.
442+ let paths: Vec < _ > = paths
443+ . iter ( )
444+ . map ( |p| {
445+ // Get the canonical path, strip the prefix, and convert to a PathBuf.
446+ match p. canonicalize ( ) {
447+ Ok ( p) => p. strip_prefix ( & builder. src ) . unwrap_or ( & p) . to_owned ( ) ,
448+ Err ( _) => {
449+ panic ! ( "failed to canonicalize path: {:?}" , p) ;
450+ }
451+ }
452+ } ) . collect ( ) ;
453+
454+ // Convert Vec<PathBuf> to `Vec<&Path>`
455+ let mut paths: Vec < & Path > = paths. iter ( ) . map ( |p| p. as_ref ( ) ) . collect ( ) ;
445456
446457 remap_paths ( & mut paths) ;
447458
You can’t perform that action at this time.
0 commit comments