Function symbolic_common::join_path[][src]

pub fn join_path(base: &str, other: &str) -> String

Joins paths of various platforms.

This attempts to detect Windows or Unix paths and joins with the correct directory separator. Also, trailing directory separators are detected in the base string and empty paths are handled correctly.

Examples

Join a relative UNIX path:

assert_eq!(symbolic_common::join_path("/a/b", "c/d"), "/a/b/c/d");

Join a Windows drive letter path path:

assert_eq!(symbolic_common::join_path("C:\\a", "b\\c"), "C:\\a\\b\\c");

If the right-hand side is an absolute path, it replaces the left-hand side:

assert_eq!(symbolic_common::join_path("/a/b", "/c/d"), "/c/d");