fix: Profile path no longer being cut off on space

Adjusted calls for setting ini variables to not skip everything after first
whitespace as well as adjusted method of reading ini file to not skip them.

Refs: #840
This commit is contained in:
Piotr Gnus 2023-12-13 17:13:02 +01:00
parent a526a818e4
commit 6ef6a381c5

View file

@ -185,7 +185,7 @@ write_file() {
get_ini_section() {
local filePath="$1"
local output=$(grep -E "^\[" "${filePath}" |sed -e "s/^\[//g" -e "s/\]$//g")
local output="$(grep -E "^\[" "${filePath}" |sed -e "s/^\[//g" -e "s/\]$//g")"
echo "${output}"
}
get_ini_value() {
@ -195,11 +195,11 @@ get_ini_value() {
local output=""
if [ "${section}" == "" ]; then
output=$(grep -E "^${key}" "${filePath}" | cut -f 2 -d"=")
output="$(grep -E "^${key}" "${filePath}" | cut -f 2 -d"=")"
echo "${output}"
else
local sectionStart=""
for line in $(cat "${filePath}"); do
while IFS= read line; do
if [[ "${sectionStart}" == "true" && "${line}" == "["* ]]; then
return 0
fi
@ -209,12 +209,12 @@ get_ini_value() {
fi
if [ "${sectionStart}" == "true" ]; then
output=$(echo "${line}" | grep -E "^${key}" | cut -f 2 -d"=" )
output="$(echo "${line}" | grep -E "^${key}" | cut -f 2 -d"=" )"
if [ "${output}" != "" ]; then
echo "${output}"
fi
fi
done
done < "${filePath}"
fi
}
@ -543,7 +543,7 @@ write_lepton_info() {
fi
for key in "Type" "Branch" "Ver" "Path"; do
eval "local value=\${${key}}"
output="${output}$(set_ini_value ${key} ${value})"
output="${output}$(set_ini_value "${key}" "${value}")"
done
# Latest element flushing