Skip to content

Commit 9144337

Browse files
committed
wip
1 parent d14cbf8 commit 9144337

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

shared/tree-sitter-extractor/src/file_paths.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@ 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;
1211
for component in path.components() {
1312
match component {
1413
std::path::Component::Prefix(prefix) => match prefix.kind() {
1514
std::path::Prefix::Disk(letter) | std::path::Prefix::VerbatimDisk(letter) => {
16-
is_disk = true;
1715
components.push(format!("{}:", letter as char));
1816
}
1917
std::path::Prefix::Verbatim(x) | std::path::Prefix::DeviceNS(x) => {
@@ -28,16 +26,13 @@ pub fn normalize_path(path: &Path) -> String {
2826
std::path::Component::Normal(n) => {
2927
components.push(n.to_string_lossy().to_string());
3028
}
31-
std::path::Component::RootDir => {}
29+
std::path::Component::RootDir => {
30+
components.push("".to_string());
31+
}
3232
std::path::Component::CurDir => {}
3333
std::path::Component::ParentDir => {}
3434
}
3535
}
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-
}
4136
components.join("/")
4237
} else {
4338
// For other operating systems, we can use the canonicalized path

0 commit comments

Comments
 (0)