Skip to main content

allow_report/
path_text.rs

1use allow_core::normalize_path;
2use std::path::Path;
3
4pub fn source_tree_path_text(path: &Path) -> String {
5    let text = path.to_string_lossy().replace('\\', "/");
6    if let Some(stripped) = text.strip_prefix("//?/UNC/") {
7        return format!("//{stripped}");
8    }
9    if let Some(stripped) = text.strip_prefix("//?/") {
10        return stripped.to_string();
11    }
12    if let Some(stripped) = text.strip_prefix("/?/") {
13        return stripped.to_string();
14    }
15    normalize_path(path)
16}