Lazy range which is the concatenation of r1, r2 and ranges with path separators. The resulting element type is that of r1.
import std.array; version (Posix) { assert(chainPath("foo", "bar", "baz").array == "foo/bar/baz"); assert(chainPath("/foo/", "bar/baz").array == "/foo/bar/baz"); assert(chainPath("/foo", "/bar").array == "/bar"); } version (Windows) { assert(chainPath("foo", "bar", "baz").array == `foo\bar\baz`); assert(chainPath(`c:\foo`, `bar\baz`).array == `c:\foo\bar\baz`); assert(chainPath("foo", `d:\bar`).array == `d:\bar`); assert(chainPath("foo", `\bar`).array == `\bar`); assert(chainPath(`c:\foo`, `\bar`).array == `c:\bar`); } import std.utf : byChar; version (Posix) { assert(chainPath("foo", "bar", "baz").array == "foo/bar/baz"); assert(chainPath("/foo/".byChar, "bar/baz").array == "/foo/bar/baz"); assert(chainPath("/foo", "/bar".byChar).array == "/bar"); } version (Windows) { assert(chainPath("foo", "bar", "baz").array == `foo\bar\baz`); assert(chainPath(`c:\foo`.byChar, `bar\baz`).array == `c:\foo\bar\baz`); assert(chainPath("foo", `d:\bar`).array == `d:\bar`); assert(chainPath("foo", `\bar`.byChar).array == `\bar`); assert(chainPath(`c:\foo`, `\bar`w).array == `c:\bar`); }
Concatenate path segments together to form one path.