fix: path case-sensitiveness bug

fix: mtshiba/pylyzer#45
This commit is contained in:
Shunsuke Shibayama 2023-07-03 22:30:26 +09:00
parent f93ee691d6
commit 1695587177
2 changed files with 16 additions and 5 deletions

View file

@ -155,7 +155,11 @@ pub fn unique_in_place<T: Eq + std::hash::Hash + Clone>(v: &mut Vec<T>) {
/// at least, this is necessary for Windows and macOS
pub fn normalize_path(path: PathBuf) -> PathBuf {
let verbatim_replaced = path.to_str().unwrap().replace("\\\\?\\", "");
let lower = verbatim_replaced.to_lowercase();
let lower = if cfg!(windows) {
verbatim_replaced.to_lowercase()
} else {
verbatim_replaced
};
PathBuf::from(lower)
}