Compare two paths for equality, canonicalizing when possible so that symlinks/`..`/trailing differences do not cause false mismatches. Falls back to a literal comparison when canonicalization fails (e.g. a path that no longer exists).
(a: &Path, b: &Path)
| 119 | /// to a literal comparison when canonicalization fails (e.g. a path that no |
| 120 | /// longer exists). |
| 121 | pub(crate) fn paths_equal(a: &Path, b: &Path) -> bool { |
| 122 | match (a.canonicalize(), b.canonicalize()) { |
| 123 | (Ok(a), Ok(b)) => normalized_paths_equal(&a, &b), |
| 124 | _ => normalized_paths_equal(a, b), |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | pub(crate) fn path_belongs_to_project(path: &Path, project_root: &Path) -> bool { |
| 129 | ProjectRootMatcher::new(project_root).contains(path) |
no test coverage detected