Function utf8_path::resolve_path

source ·
pub fn resolve_path(
    path: impl AsRef<Utf8Path>,
    resolve_from: impl AsRef<Utf8Path>
) -> Result<Utf8PathBuf>
Expand description

Helper to resolve a path that’s relative to some other path into a normalized path.

§Example

a file at: some/path/to/some/manifest_dir/some_file.txt contains within it the path: ../some/internal/path.

  use utf8_path::path_to_string::resolve_path;

  let rebased = resolve_path("../some/internal/path", "some/path/to/some/manifest_dir/")
  assert_eq!(rebased.unwrap(), "some/path/to/some/internal/path")