File tree 1 file changed +16
-4
lines changed
1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -438,20 +438,32 @@ impl StepDescription {
438
438
}
439
439
}
440
440
441
- // Resolve paths to be relative to the builder source directory.
441
+ // Attempt to resolve paths to be relative to the builder source directory.
442
442
let paths: Vec < _ > = paths
443
443
. iter ( )
444
444
. map ( |p| {
445
445
// If the path does not exist, it may represent the name of a Step, such as `tidy` in `x test tidy`
446
446
if !p. exists ( ) {
447
447
return p. clone ( ) ;
448
448
}
449
- // Get the canonical path, strip the prefix, and convert to a PathBuf.
449
+
450
+ #[ cfg( windows) ]
451
+ {
452
+ if p. is_absolute ( ) {
453
+ panic ! ( "Absolute paths are not supported on Windows" ) ;
454
+ }
455
+
456
+ // Strip current directory prefix if present
457
+ return path. strip_prefix ( "." ) . unwrap_or ( path) . to_path_buf ( ) ;
458
+ }
459
+
460
+ // Make the path absolute, strip the prefix, and convert to a PathBuf.
461
+ // FIXME: Replace `path.canonicalize()` with `std::path::absolute(path)` to support absolute paths on Windows.
450
462
match p. canonicalize ( ) {
451
- Ok ( p) => p. strip_prefix ( & builder. src ) . unwrap_or ( & p) . to_owned ( ) ,
463
+ Ok ( p) => p. strip_prefix ( & builder. src ) . unwrap_or ( & p) . to_path_buf ( ) ,
452
464
Err ( e) => {
453
465
eprintln ! ( "ERROR: {:?}" , e) ;
454
- panic ! ( "Due to the above error, failed to canonicalize path: {:?}" , p) ;
466
+ panic ! ( "Due to the above error, failed to resolve path: {:?}" , p) ;
455
467
}
456
468
}
457
469
} )
You can’t perform that action at this time.
0 commit comments