File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ use std::env;
1212use std:: ffi:: OsString ;
1313use std:: io:: prelude:: * ;
1414use std:: io;
15- use std:: path:: PathBuf ;
15+ use std:: path:: { Path , PathBuf } ;
1616use std:: panic:: { self , AssertUnwindSafe } ;
1717use std:: process:: Command ;
1818use std:: rc:: Rc ;
@@ -485,7 +485,15 @@ impl Collector {
485485
486486 pub fn get_filename ( & self ) -> String {
487487 if let Some ( ref codemap) = self . codemap {
488- codemap. span_to_filename ( self . position )
488+ let filename = codemap. span_to_filename ( self . position ) ;
489+ if let Ok ( cur_dir) = env:: current_dir ( ) {
490+ if let Ok ( path) = Path :: new ( & filename) . strip_prefix ( & cur_dir) {
491+ if let Some ( path) = path. to_str ( ) {
492+ return path. to_owned ( ) ;
493+ }
494+ }
495+ }
496+ filename
489497 } else if let Some ( ref filename) = self . filename {
490498 filename. clone ( )
491499 } else {
You can’t perform that action at this time.
0 commit comments