Function filetools::path_contains

source ·
pub fn path_contains(path: impl AsRef<Path>, pattern: impl AsRef<Path>) -> bool
Expand description

Determines if a path contains a given pattern

Converts both the path and the pattern to a string and performs simple matching

§Example

use filetools::path_contains;

let path = "This/is/a/path/with/a/file.txt";
let pattern = "file.txt";

// The path contains the pattern file.txt so this returns true
let result = path_contains(path, pattern);