Skip to main content

make_relative_path

Function make_relative_path 

Source
pub fn make_relative_path(base: &str, target: &str) -> String
Expand description

Compute the relative path from base to target.

Both paths should be absolute or relative to the same root. Uses ../ for parent directory traversal.

ยงExamples

use srcmap_sourcemap::utils::make_relative_path;
assert_eq!(make_relative_path("/a/b/c.js", "/a/d/e.js"), "../d/e.js");