File tree 1 file changed +10
-2
lines changed
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ use std::env;
12
12
use std:: ffi:: OsString ;
13
13
use std:: io:: prelude:: * ;
14
14
use std:: io;
15
- use std:: path:: PathBuf ;
15
+ use std:: path:: { Path , PathBuf } ;
16
16
use std:: panic:: { self , AssertUnwindSafe } ;
17
17
use std:: process:: Command ;
18
18
use std:: rc:: Rc ;
@@ -485,7 +485,15 @@ impl Collector {
485
485
486
486
pub fn get_filename ( & self ) -> String {
487
487
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
489
497
} else if let Some ( ref filename) = self . filename {
490
498
filename. clone ( )
491
499
} else {
You can’t perform that action at this time.
0 commit comments