Escape parens when converting to a unix path

This commit is contained in:
Michael Campagnaro 2020-12-20 23:43:32 -05:00
parent 1c85fe3fac
commit da7ef55309

View File

@ -35,7 +35,9 @@ unix_to_windows_path() {
# Fix the drive name, e.g. c\foo becomes c:\foo # Fix the drive name, e.g. c\foo becomes c:\foo
ret=$(sed 's,\([a-zA-Z]*\),\1:,' <<< "$ret") ret=$(sed 's,\([a-zA-Z]*\),\1:,' <<< "$ret")
fi fi
ret="${ret////\\}" # replace unix path with windows path ret="${ret////\\}" # Replace Unix slashes.
ret="${ret//\\\(/\(}" # Remove backslash before (.
ret="${ret//\\\)/\)}" # Remove backslash before ).
echo $ret echo $ret
fi fi
} }
@ -45,6 +47,8 @@ windows_to_unix_path() {
ret="/${ret/:/}" # Remove drive ':'. ret="/${ret/:/}" # Remove drive ':'.
ret="${ret//\\//}" # Replace Windows slashes. ret="${ret//\\//}" # Replace Windows slashes.
ret="${ret// /\\ }" # Add a backslash before spaces. ret="${ret// /\\ }" # Add a backslash before spaces.
ret="${ret//\(/\\(}" # Add a backslash before (.
ret="${ret//\)/\\)}" # Add a backslash before ).
echo "$ret" echo "$ret"
} }