From a3ee63cf8840be590de850544b315e5fd6b976c9 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Tue, 4 Feb 2025 16:10:51 +0100 Subject: [PATCH] libstd (#386): bugfixes in std::append_path(), std::prepend_path() --- Pmodules/libstd.bash | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Pmodules/libstd.bash b/Pmodules/libstd.bash index 6ff6abd..1df2673 100644 --- a/Pmodules/libstd.bash +++ b/Pmodules/libstd.bash @@ -133,6 +133,7 @@ std::append_path () { [[ "${path}" == @(|*:)${dir}@(|:*) ]] && continue dirs+="${dir}:" done + [[ -n "${dirs}" ]] || return 0 # assemble new path dirs="${dirs%:}" # remove leading ':' @@ -156,12 +157,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 }