Function is_under

Source
pub fn is_under(path: &str, folder: &str) -> bool
Expand description

true when a path is the folder itself or something inside it.

Written out because the obvious path.starts_with(folder) is wrong on strings: /music/Rock would then claim every file of /music/Rockabilly. The test is on a separator boundary, which is the difference between a folder and a prefix of its name.