Manually normalize a path by resolving . and .. components
(path: &std::path::Path)
| 174 | |
| 175 | /// Manually normalize a path by resolving . and .. components |
| 176 | fn normalize_path(path: &std::path::Path) -> std::path::PathBuf { |
| 177 | let mut components = Vec::new(); |
| 178 | for component in path.components() { |
| 179 | match component { |
| 180 | std::path::Component::CurDir => {}, |
| 181 | std::path::Component::ParentDir => { |
| 182 | components.pop(); |
| 183 | }, |
| 184 | _ => { |
| 185 | components.push(component); |
| 186 | }, |
| 187 | } |
| 188 | } |
| 189 | components.iter().collect() |
| 190 | } |
| 191 | |
| 192 | /// Given a globset builder and a path, build globs for both the file and directory patterns |
| 193 | /// This is needed because by default glob does not match children of a dir so we need both |
no outgoing calls
no test coverage detected