Skip to main content

create_relative

Function create_relative 

Source
pub fn create_relative(
    src: impl AsRef<Path>,
    dst: impl AsRef<Path>,
) -> FsResult<PathBuf>
Expand description

Create a relative path from a source to a destination:

ยงExample

assert_eq!(
	path_ext::create_relative("src", "src/lib.rs").unwrap(),
	PathBuf::from("lib.rs")
);
assert_eq!(
	path_ext::create_relative("foo/src", "foo/Cargo.toml").unwrap(),
	PathBuf::from("../Cargo.toml")
);