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