mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2024-11-22 05:55:38 +00:00
Add comment and blank line handling to reference-file-reading functions
This commit is contained in:
parent
88893a3c1b
commit
2e44842458
|
@ -158,10 +158,12 @@ check_for_version_update() {
|
|||
validate_input() {
|
||||
while IFS="^" read -r input action || [[ -n "$input" ]];
|
||||
do
|
||||
if [[ ! $input == "#"* ]] && [[ ! -z "$input" ]]; then
|
||||
if [[ "$input" == "$1" ]]; then
|
||||
eval "$action"
|
||||
input_validated="true"
|
||||
fi
|
||||
fi
|
||||
done < $input_validation
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ check_bios_files() {
|
|||
|
||||
while IFS="^" read -r bios_file bios_subdir bios_hash bios_system bios_desc || [[ -n "$bios_file" ]];
|
||||
do
|
||||
if [[ ! $bios_file == "#"* ]] && [[ ! -z "$bios_file" ]]; then
|
||||
bios_file_found="No"
|
||||
bios_hash_matched="No"
|
||||
if [[ -f "$bios_folder/$bios_subdir$bios_file" ]]; then
|
||||
|
@ -29,6 +30,7 @@ check_bios_files() {
|
|||
bios_checked_list=("${bios_checked_list[@]}" "$bios_file" "$bios_system" "$bios_file_found" "$bios_hash_matched" "$bios_desc" "$bios_subdir" "$bios_hash")
|
||||
echo "$bios_file"^"$bios_system"^"$bios_file_found"^"$bios_hash_matched"^"$bios_desc"^"$bios_subdir"^"$bios_hash" >> "$godot_bios_files_checked" # Godot data transfer temp file
|
||||
fi
|
||||
fi
|
||||
done < $bios_checklist
|
||||
}
|
||||
|
||||
|
|
|
@ -412,7 +412,7 @@ cp -fv "$1" "$3" # Create a copy of the original file to be patched
|
|||
|
||||
while IFS="^" read -r action current_section setting_name setting_value system_name || [[ -n "$action" ]];
|
||||
do
|
||||
|
||||
if [[ ! $action == "#"* ]] && [[ ! -z "$action" ]]; then
|
||||
case $action in
|
||||
|
||||
"disable_file" )
|
||||
|
@ -442,15 +442,12 @@ do
|
|||
set_setting_value "$3" "$setting_name" "$setting_value" "$system_name" "$current_section"
|
||||
;;
|
||||
|
||||
*"#"* )
|
||||
# Comment line in patch file
|
||||
;;
|
||||
|
||||
* )
|
||||
echo "Config line malformed: $action"
|
||||
log e "Config line malformed: $action"
|
||||
;;
|
||||
|
||||
esac
|
||||
fi
|
||||
done < "$2"
|
||||
}
|
||||
|
||||
|
@ -463,6 +460,7 @@ deploy_multi_patch() {
|
|||
|
||||
while IFS="^" read -r action current_section setting_name setting_value system_name config_file || [[ -n "$action" ]];
|
||||
do
|
||||
if [[ ! $action == "#"* ]] && [[ ! -z "$action" ]]; then
|
||||
case $action in
|
||||
|
||||
"disable_file" )
|
||||
|
@ -507,14 +505,11 @@ do
|
|||
set_setting_value "$config_file" "$setting_name" "$setting_value" "$system_name" "$current_section"
|
||||
;;
|
||||
|
||||
*"#"* )
|
||||
# Comment line in patch file
|
||||
;;
|
||||
|
||||
* )
|
||||
echo "Config line malformed: $action"
|
||||
log e "Config line malformed: $action"
|
||||
;;
|
||||
|
||||
esac
|
||||
fi
|
||||
done < "$1"
|
||||
}
|
||||
|
|
|
@ -363,7 +363,9 @@ finit_user_options_dialog() {
|
|||
|
||||
while IFS="^" read -r enabled option_name option_desc option_tag || [[ -n "$enabled" ]];
|
||||
do
|
||||
if [[ ! $enabled == "#"* ]] && [[ ! -z "$enabled" ]]; then
|
||||
finit_available_options=("${finit_available_options[@]}" "$enabled" "$option_name" "$option_desc" "$option_tag")
|
||||
fi
|
||||
done < $finit_options_list
|
||||
|
||||
|
||||
|
@ -581,12 +583,14 @@ easter_eggs() {
|
|||
if [[ ! -z $(cat $easter_egg_checklist) ]]; then
|
||||
while IFS="^" read -r start_date end_date start_time end_time splash_file || [[ -n "$start_date" ]]; # Read Easter Egg checklist file and separate values
|
||||
do
|
||||
if [[ ! $start_date == "#"* ]] && [[ ! -z "$start_date" ]]; then
|
||||
if [[ "$((10#$current_day))" -ge "$((10#$start_date))" && "$((10#$current_day))" -le "$((10#$end_date))" && "$((10#$current_time))" -ge "$((10#$start_time))" && "$((10#$current_time))" -le "$((10#$end_time))" ]]; then # If current line specified date/time matches current date/time, set $splash_file to be deployed
|
||||
new_splash_file="$splashscreen_dir/$splash_file"
|
||||
break
|
||||
else # When there are no matches, the default splash screen is set to deploy
|
||||
new_splash_file="$default_splash_file"
|
||||
fi
|
||||
fi
|
||||
done < $easter_egg_checklist
|
||||
else
|
||||
new_splash_file="$default_splash_file"
|
||||
|
|
|
@ -79,13 +79,16 @@ make_preset_changes() {
|
|||
fi
|
||||
set_setting_value "$rd_conf" "$emulator" "true" "retrodeck" "$preset"
|
||||
# Check for conflicting presets for this system
|
||||
while IFS=: read -r preset_being_checked known_incompatible_preset; do
|
||||
while IFS=: read -r preset_being_checked known_incompatible_preset || [[ -n "$preset_being_checked" ]];
|
||||
do
|
||||
if [[ ! $preset_being_checked == "#"* ]] && [[ ! -z "$preset_being_checked" ]]; then
|
||||
if [[ "$preset" == "$preset_being_checked" ]]; then
|
||||
if [[ $(get_setting_value "$rd_conf" "$emulator" "retrodeck" "$known_incompatible_preset") == "true" ]]; then
|
||||
changed_presets=("${changed_presets[@]}" "$known_incompatible_preset")
|
||||
set_setting_value "$rd_conf" "$emulator" "false" "retrodeck" "$known_incompatible_preset"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done < "$incompatible_presets_reference_list"
|
||||
fi
|
||||
if [[ ! " ${choices[*]} " =~ " ${emulator} " && ! " ${current_disabled_systems[*]} " =~ " ${emulator} " ]]; then
|
||||
|
@ -118,6 +121,7 @@ build_preset_config() {
|
|||
local read_system_enabled=$(get_setting_value "$rd_conf" "$read_system_name" "retrodeck" "$current_preset")
|
||||
while IFS='^' read -r action read_preset read_setting_name new_setting_value section target_file defaults_file || [[ -n "$action" ]];
|
||||
do
|
||||
if [[ ! $action == "#"* ]] && [[ ! -z "$action" ]]; then
|
||||
case "$action" in
|
||||
|
||||
"config_file_format" )
|
||||
|
@ -191,6 +195,7 @@ build_preset_config() {
|
|||
;;
|
||||
|
||||
esac
|
||||
fi
|
||||
done < <(cat "$presets_dir/$read_system_name"_presets.cfg)
|
||||
fi
|
||||
done < <(printf '%s\n' "$preset_section")
|
||||
|
|
Loading…
Reference in a new issue