Skip to content

Commit

Permalink
Fix joinPathOS method that fails on solaris (#3572)
Browse files Browse the repository at this point in the history
* Fix joinPathOS method that fails on solaris, used IFS together with tr to remove duplicate slashes which should work anywhere.
* Apply fix also for joinPath function.
* Take review comments into account.
  • Loading branch information
netomi authored Dec 14, 2023
1 parent 5bc9f1a commit 4d60aef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sbin/common/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function setDockerVolumeSuffix() {

# Joins multiple parts to a valid file path for the current OS
function joinPathOS() {
local path=$(printf '/%s' "${@}" | sed 's|/\+|/|g')
local path=$(echo "/${*}" | tr ' ' / | tr -s /)
if [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]]; then
path=$(cygpath -w "${path}")
fi
Expand All @@ -107,7 +107,7 @@ function joinPathOS() {

# Joins multiple parts to a valid file path using slashes
function joinPath() {
local path=$(printf '/%s' "${@}" | sed 's|/\+|/|g')
local path=$(echo "/${*}" | tr ' ' / | tr -s /)
echo "${path}"
}

Expand Down

0 comments on commit 4d60aef

Please sign in to comment.