File tree 1 file changed +3
-8
lines changed
1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -8,12 +8,10 @@ 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 ;
12
11
for component in path. components ( ) {
13
12
match component {
14
13
std:: path:: Component :: Prefix ( prefix) => match prefix. kind ( ) {
15
14
std:: path:: Prefix :: Disk ( letter) | std:: path:: Prefix :: VerbatimDisk ( letter) => {
16
- is_disk = true ;
17
15
components. push ( format ! ( "{}:" , letter as char ) ) ;
18
16
}
19
17
std:: path:: Prefix :: Verbatim ( x) | std:: path:: Prefix :: DeviceNS ( x) => {
@@ -28,16 +26,13 @@ pub fn normalize_path(path: &Path) -> String {
28
26
std:: path:: Component :: Normal ( n) => {
29
27
components. push ( n. to_string_lossy ( ) . to_string ( ) ) ;
30
28
}
31
- std:: path:: Component :: RootDir => { }
29
+ std:: path:: Component :: RootDir => {
30
+ components. push ( "" . to_string ( ) ) ;
31
+ }
32
32
std:: path:: Component :: CurDir => { }
33
33
std:: path:: Component :: ParentDir => { }
34
34
}
35
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
- }
41
36
components. join ( "/" )
42
37
} else {
43
38
// For other operating systems, we can use the canonicalized path
You can’t perform that action at this time.
0 commit comments