resolve_path

Function resolve_path 

Source
pub fn resolve_path(
    path: impl AsRef<Path>,
    base_dir: Option<&Path>,
) -> Result<ModuleSpecifier, Error>
Expand description

Resolve a path to absolute path, relative to the current working directory or an optional base directory

The resulting ModuleSpecifier is a wrapper around reqwest::Url

§Arguments

  • path - A path
  • base_dir - An optional base directory to resolve the path from
    If not provided, the current working directory is used

§Errors

Will return an error if the given path is invalid

§Example

rustyscript::resolve_path("test.js", None).expect("Something went wrong!");