1 use std::io; 2 use std::path::Path; 3 4 use super::BasePathBuf; 5 6 #[inline(always)] is_base(_: &Path) -> bool7pub(super) fn is_base(_: &Path) -> bool { 8 true 9 } 10 11 #[inline(always)] to_base(_: &Path) -> io::Result<BasePathBuf>12pub(super) fn to_base(_: &Path) -> io::Result<BasePathBuf> { 13 unreachable!(); 14 } 15 normalize(path: &Path) -> io::Result<BasePathBuf>16pub(super) fn normalize(path: &Path) -> io::Result<BasePathBuf> { 17 // This method rejects null bytes and empty paths, which is consistent with 18 // [GetFullPathNameW] on Windows. 19 path.canonicalize().and_then(BasePathBuf::new) 20 } 21 push(base: &mut BasePathBuf, path: &Path)22pub(super) fn push(base: &mut BasePathBuf, path: &Path) { 23 if !path.as_os_str().is_empty() { 24 base.replace_with(|mut base| { 25 base.push(path); 26 base 27 }); 28 } 29 } 30