use crate::StoragePath;
impl StoragePath {
pub fn is_folder(&self) -> bool {
self.relative_path().is_empty() || self.path().ends_with(self.file_separator())
}
}
#[cfg(test)]
mod tests {
use crate::StoragePath;
#[test]
fn is_file_or_folder() {
let path: StoragePath = unsafe { StoragePath::new("/the/path", 1, '/') };
assert!(!path.is_folder());
let path: StoragePath = unsafe { StoragePath::new("/the/path/", 1, '/') };
assert!(path.is_folder());
let path: StoragePath = unsafe { StoragePath::new("!", 1, '/') };
assert!(path.is_folder());
}
}