resolve_case_instenstive returns a result<option> now
This commit is contained in:
@@ -34,7 +34,7 @@ pub fn path_to_lowercase(path: impl AsRef<Path>) -> PathBuf {
|
||||
pub fn resolve_case_insensitive(
|
||||
base: impl AsRef<Path>,
|
||||
rel: impl AsRef<Path>,
|
||||
) -> io::Result<PathBuf> {
|
||||
) -> io::Result<Option<PathBuf>> {
|
||||
let mut current = base.as_ref().to_path_buf();
|
||||
|
||||
for part in rel.as_ref().iter() {
|
||||
@@ -56,13 +56,10 @@ pub fn resolve_case_insensitive(
|
||||
match found {
|
||||
Some(path) => current = path,
|
||||
None => {
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::NotFound,
|
||||
format!("Path component not found: {}", target),
|
||||
));
|
||||
return Ok(None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(current)
|
||||
Ok(Some(current))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user