ouisync/
path.rs

1//! Utilities for working with filesystem paths.
2
3use camino::Utf8Path;
4
5/// Decomposes `path` into parent and filename. Returns `None` if `path` doesn't have parent
6/// (it's the root).
7pub fn decompose(path: &Utf8Path) -> Option<(&Utf8Path, &str)> {
8    match (path.parent(), path.file_name()) {
9        (Some(parent), Some(name)) => Some((parent, name)),
10        _ => None,
11    }
12}