Merge branch '386-libstd-bugs-in-std-append_path-and-std-prepend_path' into '1.1.22'

Resolve "libstd: bugs in std::append_path() and std::prepend_path()"

See merge request Pmodules/src!412

(cherry picked from commit e0841bce39)

a3ee63cf libstd (#386): bugfixes in std::append_path(), std::prepend_path()

Co-authored-by: gsell <achim.gsell@psi.ch>
This commit is contained in:
2025-02-04 16:26:04 +01:00
parent 4f1a134c90
commit 9028999da5
+3 -1
View File
@@ -285,6 +285,7 @@ std::append_path () {
[[ "${path}" == @(|*:)${dir}@(|:*) ]] && continue
dirs+="${dir}:"
done
[[ -n "${dirs}" ]] || return 0
# assemble new path
dirs="${dirs%:}" # remove leading ':'
@@ -308,12 +309,13 @@ std::prepend_path () {
[[ "${path}" == @(|*:)${dir}@(|:*) ]] && continue
dirs+="${dir}:"
done
[[ -n "${dirs}" ]] || return 0
# assemble new path
dirs="${dirs%:}" # remove leading ':'
if [[ -z ${path} ]]; then
path="${dirs}"
else
else
path="${dirs}:${path}"
fi
}