utf8_path

Function resolve_path_from_file

Source
pub fn resolve_path_from_file(
    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/a/manifest.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.txt")
  assert_eq!(rebased.unwrap(), "some/path/to/some/internal/path")