I want to check if a path is a subdirectory of another path:
use std::path::Path;
let path = Path::new("/foo/bar/");
let child = Path::new("/foo/bar/baz");
assert_eq!(is_subdirectory(path, child), true);
How to do this?
I want to check if a path is a subdirectory of another path:
use std::path::Path;
let path = Path::new("/foo/bar/");
let child = Path::new("/foo/bar/baz");
assert_eq!(is_subdirectory(path, child), true);
How to do this?
Path's method starts_with works
use std::path::Path;
let path = Path::new("/foo/bar/");
let child = Path::new("/foo/bar/baz");
assert_eq!(child.starts_with(path), true);
assert_eq!(path.starts_with(child), false);