join_paths()

Joins the given strings into a file system path segment. For example join_paths('foo', 'bar') results in foo/bar. If any one of the individual segments is an absolute path, all segments before it are dropped. That means that join_paths('foo', '/bar') returns /bar.

(since 0.49.0) Using the / operator on strings is equivalent to calling join_paths().

# res1 and res2 will have identical values
res1 = join_paths(foo, bar)
res2 = foo / bar

Signature

(since 0.36.0)

# Joins the given strings into a file system path segment
str join_paths(
  str part...,  # The path parts to join
)

Arguments

The function accepts between 1 and infinity variadic arguments (part...) of type str.

The path parts to join.

The results of the search are