join_paths

Macro join_paths 

Source
macro_rules! join_paths {
    ($base:expr, $($sub_path:expr),+) => { ... };
}
Expand description

Combines multiple paths into a single valid path, handling overlapping slashes.

  • Removes trailing slashes from the base path.
  • Removes leading slashes from subsequent paths to avoid duplication.
  • Supports multiple path segments for flexible usage.

§Parameters

  • base: The base path as a string slice. It serves as the starting point for the combined path.
  • sub_path: One or more subsequent paths as string slices. These are appended to the base path in order.

§Returns

  • String: The resulting combined path as a String, with platform-specific separators and cleaned of redundant slashes.