Merge pull request #7585 from invadergir/allow-spaces-in-build-properties

Trim spaces around k and v to tolerate extra whitespace in build.properties
This commit is contained in:
eugene yokota 2024-08-08 02:22:06 -04:00 committed by GitHub
commit 2f936295f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 0 deletions

11
sbt
View File

@ -89,6 +89,14 @@ cygwinpath() {
fi
}
# Trim leading and trailing spaces from a string.
# Echos the new trimmed string.
trimString() {
local inputStr="$*"
local modStr="${inputStr#"${inputStr%%[![:space:]]*}"}"
modStr="${modStr%"${modStr##*[![:space:]]}"}"
echo "$modStr"
}
declare -r sbt_bin_dir="$(dirname "$(realpathish "$0")")"
declare -r sbt_home="$(dirname "$sbt_bin_dir")"
@ -707,6 +715,9 @@ loadConfigFile() {
}
loadPropFile() {
# trim key and value so as to be more forgiving with spaces around the '=':
k=$(trimString $k)
v=$(trimString $v)
while IFS='=' read -r k v; do
if [[ "$k" == "sbt.version" ]]; then
build_props_sbt_version="$v"