]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
models : handle spaces and special characters in shell script paths (#677)
authorbe-next <redacted>
Wed, 29 Mar 2023 20:38:33 +0000 (22:38 +0200)
committerGitHub <redacted>
Wed, 29 Mar 2023 20:38:33 +0000 (23:38 +0300)
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.

models/download-ggml-model.sh

index 6fda18ea55d5fa12c67d8d49a60a5ac27eac3d7d..749b409c4ffe983863b991f4ea3873ac3b36bd67 100755 (executable)
@@ -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"