Function html5_picture::path::remove_base_dir[][src]

pub fn remove_base_dir(
    base_dir: &PathBuf,
    input_file: &PathBuf
) -> Result<PathBuf, String>
Expand description

Removes the given base directory from the given input file.

Example

use {
    html5_picture::path::remove_base_dir,
    std::path::PathBuf,
};

let base_dir = PathBuf::from("../assets");
let input_file = PathBuf::from("../assets/some_other/directory/picture.png");
let output = remove_base_dir(&base_dir, &input_file).unwrap();
assert_eq!(output.to_str().unwrap(), "some_other/directory/picture.png");