File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,12 @@ pub fn normalize_path(path: &Path) -> String {
88 // have to do a bit of work removing certain prefixes and replacing
99 // backslashes.
1010 let mut components: Vec < String > = Vec :: new ( ) ;
11+ let mut is_disk = false ;
1112 for component in path. components ( ) {
1213 match component {
1314 std:: path:: Component :: Prefix ( prefix) => match prefix. kind ( ) {
1415 std:: path:: Prefix :: Disk ( letter) | std:: path:: Prefix :: VerbatimDisk ( letter) => {
16+ is_disk = true ;
1517 components. push ( format ! ( "{}:" , letter as char ) ) ;
1618 }
1719 std:: path:: Prefix :: Verbatim ( x) | std:: path:: Prefix :: DeviceNS ( x) => {
@@ -31,6 +33,11 @@ pub fn normalize_path(path: &Path) -> String {
3133 std:: path:: Component :: ParentDir => { }
3234 }
3335 }
36+ if components. len ( ) == 1 && is_disk {
37+ // If the path is just a drive letter, we need to add a trailing
38+ // slash to match the CodeQL spec.
39+ components. push ( "" . to_string ( ) ) ;
40+ }
3441 components. join ( "/" )
3542 } else {
3643 // For other operating systems, we can use the canonicalized path
You can’t perform that action at this time.
0 commit comments