From: be-next Date: Wed, 29 Mar 2023 20:38:33 +0000 (+0200) Subject: models : handle spaces and special characters in shell script paths (#677) X-Git-Tag: upstream/1.7.4~1525 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=18e6fb0287b5f851a5c0fbd0bb13b66f7197e540;p=pkg%2Fggml%2Fsources%2Fwhisper.cpp models : handle spaces and special characters in shell script paths (#677) This commit modifies the `get_script_path` function to correctly handle spaces and special characters in directory paths. The fix involves adding double quotes around variables and commands where needed to ensure proper parsing of paths with spaces and special characters. --- diff --git a/models/download-ggml-model.sh b/models/download-ggml-model.sh index 6fda18ea..749b409c 100755 --- a/models/download-ggml-model.sh +++ b/models/download-ggml-model.sh @@ -12,7 +12,7 @@ pfx="resolve/main/ggml" # get the path of this script function get_script_path() { if [ -x "$(command -v realpath)" ]; then - echo "$(dirname $(realpath $0))" + echo "$(dirname "$(realpath "$0")")" else local ret="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)" echo "$ret"