pathbuf-ext

Crates.iopathbuf-ext
lib.rspathbuf-ext
version0.1.0
sourcesrc
created_at2023-08-29 12:27:30.080567
updated_at2023-08-29 12:27:30.080567
descriptionExtends PathBuf to handle `replace` and `contains` string methods
homepagehttps://gitlab.com/zitrussaft1/pathbuf-ext
repositoryhttps://gitlab.com/zitrussaft1/pathbuf-ext
max_upload_size
id958027
size6,021
(zitrussaft)

documentation

https://gitlab.com/zitrussaft1/pathbuf-ext

README

Extended PathBuf

Here are some examples on how to use it:

let path = Path::new("C:\\Users\\user\\Desktop\\test.txt");
let path = path.replace("user/Desktop", "user/Documents");
assert_eq!(path, PathBuf::from("C:\\Users\\user\\Documents\\test.txt"));
let path = Path::new("C:\\Users\\user\\Desktop\\test.txt");
assert!(path.contains("Desktop"));
assert!(!path.contains("Documents"));

// Windows
assert!(path.contains("user\\Desktop"));
assert!(!path.contains("user\\Documents"));

// Linux
assert!(path.contains("user/Desktop"));
assert!(!path.contains("user/Documents"));
Commit count: 1

cargo fmt