pub fn resolve_source_path(
src_path: &str,
source_file: &Path,
) -> Result<PathBuf, PathError>Expand description
Resolve a portable, /-separated src_path (as written in a source file)
relative to the directory containing source_file.
A convenience wrapper over resolve_relative: the base is source_file’s
parent, or the current directory when source_file is a bare filename.
Absolute or rooted src_path values pass through unchanged.
§Errors
Propagates PathError from resolve_relative when src_path has a
segment that is not a single portable name.
§Examples
use std::path::Path;
use mos_core::resolve_source_path;
assert_eq!(
resolve_source_path("img/a.png", Path::new("proj/main.mos")),
Ok(Path::new("proj").join("img").join("a.png")),
);