TODO: purge this function in the future, if you absolutely do not use it anywhere.
Deprecated
Note
you'd probably want to use joinPaths instead of this function, for any realistic set of path segments.
not only is this more expensive to compute, it does not distinguish between a directory and a file path (intentionally).
join path segments with forward-slashes in between, and remove redundant slashes ("/") and dotslashes ("./") around each segment (if any).
however, the first segment's leading and trailing slashes are left untouched,
because that would potentially strip away location information (such as relative path ("./"), or absolute path ("/"), or some uri ("file:///")).
if you want to ensure that your first segment is shortened, use either the normalizePath or normalizePosixPath function on it before passing it here.
Warning
it is recommended that you use segments with posix path dir-separators ("/").
TODO: purge this function in the future, if you absolutely do not use it anywhere.
Deprecated
you'd probably want to use joinPaths instead of this function, for any realistic set of path segments. not only is this more expensive to compute, it does not distinguish between a directory and a file path (intentionally).
join path segments with forward-slashes in between, and remove redundant slashes ("/") and dotslashes ("./") around each segment (if any). however, the first segment's leading and trailing slashes are left untouched, because that would potentially strip away location information (such as relative path ("./"), or absolute path ("/"), or some uri ("file:///")).
if you want to ensure that your first segment is shortened, use either the normalizePath or normalizePosixPath function on it before passing it here.
it is recommended that you use segments with posix path dir-separators ("/").
Example