Skip to content

Commit

Permalink
Fix joinPath() to handle leading directory separators correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
djonas-noip committed Aug 31, 2021
1 parent c264e26 commit 350ebcd
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions composer-lock-diff
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,17 @@ function dirnameSafe($path) {
}

function joinPath(/* path parts */) {
return implode(DIRECTORY_SEPARATOR, array_map(function($part) {
$args = func_get_args();
$head = $args[0];
$lead = '';

if ($head[0] == DIRECTORY_SEPARATOR) {
$lead = DIRECTORY_SEPARATOR;
}

return $lead . implode(DIRECTORY_SEPARATOR, array_map(function($part) {
return trim($part, DIRECTORY_SEPARATOR);
}, func_get_args()));
}, $args));
}

function ensureTrailingPathSep($path) {
Expand Down

0 comments on commit 350ebcd

Please sign in to comment.