• R/O
  • HTTP
  • SSH
  • HTTPS

crshini: Commit

GitHubのミラーです
https://github.com/hayao0819/crshini


Commit MetaInfo

Revisão029223bf740f8a2c476b58dc06fb8d73c15626b5 (tree)
Hora2021-06-07 22:32:01
Autorhayao <hayao@fasc...>
Commiterhayao

Mensagem de Log

[fix] : Fixed a bug that value rewriting could not be done normally

Mudança Sumário

Diff

--- a/src/libcrshini
+++ b/src/libcrshini
@@ -164,7 +164,7 @@ _crshini_set(){
164164 # Find and Set param
165165 if printf "%s\n" "${_crshini_set_paramlist[@]}" | grep -x "${_crshini_set_param}" 1> /dev/null 2>&1; then
166166 _crshini_msg_dbg "値の書き換えを行います"
167- _crshini_set_insert_line=$(( "$(_crshini_output="-" _crshini_get_linemode=true _crshini_get "${_crshini_set_file}" "${_crshini_set_section}" "${_crshini_set_param}")" - 1 ))
167+ _crshini_set_insert_line=$(( "$(_crshini_output="-" _crshini_get_linemode=true _crshini_get "${_crshini_set_file}" "${_crshini_set_section}" "${_crshini_set_param}")" ))
168168 elif (( "${#_crshini_set_paramlist[@]}" == 0 )) || [[ -z "${_crshini_set_paramlist[*]}" ]]; then
169169 _crshini_msg_dbg "空のセクションに値を追加します"
170170 _crshini_set_insert_line="$(( $(_crshini_output="-" _crshini_index_from_str "[${_crshini_set_section}]" "${_crshini_set_fileline[@]}") + 1))"
@@ -175,20 +175,19 @@ _crshini_set(){
175175
176176 _crshini_msg_dbg "${_crshini_set_insert_line}行目に設定されました"
177177
178- for __line in $( seq 0 $(( "${#_crshini_set_fileline[@]}")) ); do
178+ for __line in $( seq $(( "${#_crshini_set_fileline[@]}" + 1 )) ); do
179+ _crshini_set_now_line="${_crshini_set_fileline[$(( __line - 1 ))]-""}" _crshini_set_next_line="${_crshini_set_fileline[${__line}]-""}"
179180 if [[ "${_crshini_set_writed}" = true ]] ; then
180- if [[ -n "${_crshini_set_fileline[${__line}]+SET}" ]]; then
181- _crshini_set_modline+=("${_crshini_set_fileline[${__line}]}")
181+ if [[ -n "${_crshini_set_now_line+SET}" ]]; then
182+ _crshini_set_modline+=("${_crshini_set_now_line}")
182183 continue
183184 fi
184185 elif ! (( __line == _crshini_set_insert_line)); then
185- if [[ -n "${_crshini_set_fileline[${__line}]+SET}" ]]; then
186- _crshini_set_modline+=("${_crshini_set_fileline[${__line}]}")
187- fi
186+ [[ -n "${_crshini_set_now_line+SET}" ]] && _crshini_set_modline+=("${_crshini_set_now_line}")
188187 else
189188 _crshini_msg_dbg "${__line}行目を書き換えました"
190189 _crshini_set_modline+=("${_crshini_set_param}=${_crshini_set_value}") _crshini_set_writed=true
191- if [[ -z "${_crshini_set_fileline[$(( __line + 1 ))]+SET}" ]] || [[ "${_crshini_set_fileline[$(( __line + 1 ))]}" = "["*"]" ]]; then
190+ if [[ -z "${_crshini_set_next_line+SET}" ]] || [[ "${_crshini_set_next_line}" = "["*"]" ]]; then
192191 _crshini_set_modline+=("")
193192 fi
194193 fi
Show on old repository browser