pub fn determine_path(
root_path: impl AsRef<Utf8Path>,
member_path: &Option<impl AsRef<Utf8Path>>,
path: impl AsRef<Utf8Path>,
) -> Result<Option<Utf8PathBuf>>Expand description
Creates a workspace-safe relative path. Takes the following arguments:
- The root path of the workspace (or single project)
- An optional workspace member path
- The path itself, usually extracted from the configuration Member path and the path itself can be relative or absolute . The function will attempt to lazily build the smallest possible absolute and canonicalized path, before diffing it with the root path to create a path that’s always relative to the workspace root.
Some example scenarios:
- root path = “/my/directory”, member path = None, path = “myfile.md” Output = “myfile.md”
- root path = “/my/directory”, member path = “member”, path = “myfile.md” Output = “member/myfile.md”
- root path= “/my/directory”, member path = “/my/directory/member”, path = “../root.md” Output = “root.md”