diff options
author | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2011-01-25 21:59:03 +0100 |
---|---|---|
committer | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2011-01-25 21:59:03 +0100 |
commit | 8efc6dae8a781e3fc058cda0b49a0a6cfd745bb5 (patch) | |
tree | 4dfc251f7be1bb889d2c0beacd69c72ac68448ef /scripts/functions | |
parent | 94be1f470c148afe1b7b2a7e43b886c4ddea2e15 (diff) | |
download | crosstool-ng-8efc6dae8a781e3fc058cda0b49a0a6cfd745bb5.tar.gz crosstool-ng-8efc6dae8a781e3fc058cda0b49a0a6cfd745bb5.tar.bz2 crosstool-ng-8efc6dae8a781e3fc058cda0b49a0a6cfd745bb5.zip |
scripts: fix double slash in paths
Computed paths may contain double slashes.
This is not an issue but it is just ugly to look at.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Diffstat (limited to 'scripts/functions')
-rw-r--r-- | scripts/functions | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/functions b/scripts/functions index 0bc16f7f..ba92d118 100644 --- a/scripts/functions +++ b/scripts/functions @@ -159,6 +159,24 @@ CT_SanitizePath() { PATH="${new}" } +# Sanitise the directory name contained in the variable passed as argument: +# - remove duplicate / +# Usage: CT_SanitiseVarDir CT_PREFIX_DIR +CT_SanitiseVarDir() { + local var + local old_dir + local new_dir + + for var in "$@"; do + eval "old_dir=\"\${${var}}\"" + new_dir="$( printf "${old_dir}" \ + |sed -r -e 's:/+:/:g;' \ + )" + eval "${var}=\"${new_dir}\"" + CT_DoLog DEBUG "Sanitised '${var}': '${old_dir}' -> '${new_dir}'" + done +} + # Abort the execution with an error message # Usage: CT_Abort <message> CT_Abort() { |