File tree 2 files changed +17
-10
lines changed
2 files changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,12 @@ pub fn normalize_path(path: &Path) -> String {
8
8
// have to do a bit of work removing certain prefixes and replacing
9
9
// backslashes.
10
10
let mut components: Vec < String > = Vec :: new ( ) ;
11
+ let mut is_disk = false ;
11
12
for component in path. components ( ) {
12
13
match component {
13
14
std:: path:: Component :: Prefix ( prefix) => match prefix. kind ( ) {
14
15
std:: path:: Prefix :: Disk ( letter) | std:: path:: Prefix :: VerbatimDisk ( letter) => {
16
+ is_disk = true ;
15
17
components. push ( format ! ( "{}:" , letter as char ) ) ;
16
18
}
17
19
std:: path:: Prefix :: Verbatim ( x) | std:: path:: Prefix :: DeviceNS ( x) => {
@@ -31,6 +33,11 @@ pub fn normalize_path(path: &Path) -> String {
31
33
std:: path:: Component :: ParentDir => { }
32
34
}
33
35
}
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
+ }
34
41
components. join ( "/" )
35
42
} else {
36
43
// For other operating systems, we can use the canonicalized path
You can’t perform that action at this time.
0 commit comments