mirror of
https://github.com/Pmodules/Pmodules.git
synced 2026-06-27 01:53:08 +02:00
libstd (#386): bugfixes in std::append_path(), std::prepend_path()
This commit is contained in:
@@ -133,6 +133,7 @@ std::append_path () {
|
|||||||
[[ "${path}" == @(|*:)${dir}@(|:*) ]] && continue
|
[[ "${path}" == @(|*:)${dir}@(|:*) ]] && continue
|
||||||
dirs+="${dir}:"
|
dirs+="${dir}:"
|
||||||
done
|
done
|
||||||
|
[[ -n "${dirs}" ]] || return 0
|
||||||
|
|
||||||
# assemble new path
|
# assemble new path
|
||||||
dirs="${dirs%:}" # remove leading ':'
|
dirs="${dirs%:}" # remove leading ':'
|
||||||
@@ -156,12 +157,13 @@ std::prepend_path () {
|
|||||||
[[ "${path}" == @(|*:)${dir}@(|:*) ]] && continue
|
[[ "${path}" == @(|*:)${dir}@(|:*) ]] && continue
|
||||||
dirs+="${dir}:"
|
dirs+="${dir}:"
|
||||||
done
|
done
|
||||||
|
[[ -n "${dirs}" ]] || return 0
|
||||||
|
|
||||||
# assemble new path
|
# assemble new path
|
||||||
dirs="${dirs%:}" # remove leading ':'
|
dirs="${dirs%:}" # remove leading ':'
|
||||||
if [[ -z ${path} ]]; then
|
if [[ -z ${path} ]]; then
|
||||||
path="${dirs}"
|
path="${dirs}"
|
||||||
else
|
else
|
||||||
path="${dirs}:${path}"
|
path="${dirs}:${path}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user