mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2025-01-18 14:55:38 +00:00
Fixed presets engine handling paths with spaces
This commit is contained in:
parent
f76fda9e38
commit
89584bb056
|
@ -1,7 +1,7 @@
|
||||||
config_file_format^retroarch
|
config_file_format^retroarch
|
||||||
target_file^/var/config/retroarch/config/Genesis Plus GX/genesis.cfg
|
target_file^/var/config/retroarch/config/Genesis Plus GX/genesis.cfg
|
||||||
defaults_file^$emuconfigs/retroarch/retroarch.cfg
|
defaults_file^$emuconfigs/retroarch/retroarch.cfg
|
||||||
change^borders^input_overlay^input_overlay^/var/config/retroarch/overlays/borders/pegasus/genesis.cfg
|
change^borders^input_overlay^/var/config/retroarch/overlays/borders/pegasus/genesis.cfg
|
||||||
change^borders^input_overlay_aspect_adjust_landscape^0.100000
|
change^borders^input_overlay_aspect_adjust_landscape^0.100000
|
||||||
change^borders^input_overlay_enable^true
|
change^borders^input_overlay_enable^true
|
||||||
change^borders^input_overlay_scale_landscape^1.040000
|
change^borders^input_overlay_scale_landscape^1.040000
|
||||||
|
|
|
@ -151,12 +151,12 @@ add_setting_line() {
|
||||||
* )
|
* )
|
||||||
if [[ -z $current_section_name ]]; then
|
if [[ -z $current_section_name ]]; then
|
||||||
if [[ -f "$1" ]]; then
|
if [[ -f "$1" ]]; then
|
||||||
sed -i '$ a '"$current_setting_line"'' $1
|
sed -i '$ a '"$current_setting_line"'' "$1"
|
||||||
else # If the file doesn't exist, sed add doesn't work for the first line
|
else # If the file doesn't exist, sed add doesn't work for the first line
|
||||||
echo "$current_setting_line" > $1
|
echo "$current_setting_line" > $1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
sed -i '/^\s*?\['"$current_section_name"'\]|\b'"$current_section_name"':$/a '"$current_setting_line"'' $1
|
sed -i '/^\s*?\['"$current_section_name"'\]|\b'"$current_section_name"':$/a '"$current_setting_line"'' "$1"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -175,9 +175,9 @@ add_setting() {
|
||||||
|
|
||||||
"retroarch" )
|
"retroarch" )
|
||||||
if [[ -z $current_section_name ]]; then
|
if [[ -z $current_section_name ]]; then
|
||||||
sed -i '$ a '"$current_setting_name"' = "'"$current_setting_value"'"' $1
|
sed -i '$ a '"$current_setting_name"' = "'"$current_setting_value"'"' "$1"
|
||||||
else
|
else
|
||||||
sed -i '/^\s*?\['"$current_section_name"'\]|\b'"$current_section_name"':$/a '"$current_setting_name"' = "'"$current_setting_value"'"' $1
|
sed -i '/^\s*?\['"$current_section_name"'\]|\b'"$current_section_name"':$/a '"$current_setting_name"' = "'"$current_setting_value"'"' "$1"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -214,9 +214,9 @@ disable_setting() {
|
||||||
|
|
||||||
* )
|
* )
|
||||||
if [[ -z $current_section_name ]]; then
|
if [[ -z $current_section_name ]]; then
|
||||||
sed -i -E 's^(\s*?)'"$current_setting_line"'^\1#'"$current_setting_line"'^' $1
|
sed -i -E 's^(\s*?)'"$current_setting_line"'^\1#'"$current_setting_line"'^' "$1"
|
||||||
else
|
else
|
||||||
sed -i -E '\^\['"$current_section_name"'\]|\b'"$current_section_name"':$^,\^\s*?'"$current_setting_line"'^s^(\s*?)'"$current_setting_line"'^\1#'"$current_setting_line"'^' $1
|
sed -i -E '\^\['"$current_section_name"'\]|\b'"$current_section_name"':$^,\^\s*?'"$current_setting_line"'^s^(\s*?)'"$current_setting_line"'^\1#'"$current_setting_line"'^' "$1"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -234,9 +234,9 @@ enable_setting() {
|
||||||
|
|
||||||
* )
|
* )
|
||||||
if [[ -z $current_section_name ]]; then
|
if [[ -z $current_section_name ]]; then
|
||||||
sed -i -E 's^(\s*?)#'"$current_setting_line"'^\1'"$current_setting_line"'^' $1
|
sed -i -E 's^(\s*?)#'"$current_setting_line"'^\1'"$current_setting_line"'^' "$1"
|
||||||
else
|
else
|
||||||
sed -i -E '\^\['"$current_section_name"'\]|\b'"$current_section_name"':$^,\^\s*?#'"$current_setting_line"'^s^(\s*?)#'"$current_setting_line"'^\1'"$current_setting_line"'^' $1
|
sed -i -E '\^\['"$current_section_name"'\]|\b'"$current_section_name"':$^,\^\s*?#'"$current_setting_line"'^s^(\s*?)#'"$current_setting_line"'^\1'"$current_setting_line"'^' "$1"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ disable_file() {
|
||||||
# USAGE: disable_file $file_name
|
# USAGE: disable_file $file_name
|
||||||
# NOTE: $filename can be a defined variable from global.sh or must have the full path to the file
|
# NOTE: $filename can be a defined variable from global.sh or must have the full path to the file
|
||||||
|
|
||||||
mv $(realpath $1) $(realpath $1).disabled
|
mv "$(realpath "$1")" "$(realpath "$1")".disabled
|
||||||
}
|
}
|
||||||
|
|
||||||
enable_file() {
|
enable_file() {
|
||||||
|
@ -256,7 +256,7 @@ enable_file() {
|
||||||
# USAGE: enable_file $file_name
|
# USAGE: enable_file $file_name
|
||||||
# NOTE: $filename can be a defined variable from global.sh or must have the full path to the file and should not have ".disabled" as a suffix
|
# NOTE: $filename can be a defined variable from global.sh or must have the full path to the file and should not have ".disabled" as a suffix
|
||||||
|
|
||||||
mv $(realpath $1.disabled) $(realpath $(echo $1 | sed -e 's/\.disabled//'))
|
mv "$(realpath "$1".disabled)" "$(realpath "$(echo "$1" | sed -e 's/\.disabled//')")"
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_single_patch() {
|
generate_single_patch() {
|
||||||
|
|
|
@ -121,8 +121,8 @@ build_preset_config() {
|
||||||
if [[ "$read_config_format" == "retroarch" ]]; then # If this is a RetroArch core, generate the override file
|
if [[ "$read_config_format" == "retroarch" ]]; then # If this is a RetroArch core, generate the override file
|
||||||
if [[ -z $(grep "$read_setting_name" "$read_target_file") ]]; then
|
if [[ -z $(grep "$read_setting_name" "$read_target_file") ]]; then
|
||||||
if [[ ! -f "$read_target_file" ]]; then
|
if [[ ! -f "$read_target_file" ]]; then
|
||||||
mkdir -p "$(realpath $(dirname "$read_target_file"))"
|
mkdir -p "$(realpath "$(dirname "$read_target_file")")"
|
||||||
echo "$read_setting_name = ""$new_setting_value""" > "$read_target_file"
|
echo "$read_setting_name = \""$new_setting_value"\"" > "$read_target_file"
|
||||||
else
|
else
|
||||||
add_setting "$read_target_file" "$read_setting_name" "$new_setting_value" "$read_config_format" "$section"
|
add_setting "$read_target_file" "$read_setting_name" "$new_setting_value" "$read_config_format" "$section"
|
||||||
fi
|
fi
|
||||||
|
@ -142,8 +142,8 @@ build_preset_config() {
|
||||||
if [[ -z $(cat "$read_target_file") ]]; then # If the override file is empty
|
if [[ -z $(cat "$read_target_file") ]]; then # If the override file is empty
|
||||||
rm -f "$read_target_file"
|
rm -f "$read_target_file"
|
||||||
fi
|
fi
|
||||||
if [[ -z $(ls -1 $(dirname "$read_target_file")) ]]; then # If the override folder is empty
|
if [[ -z $(ls -1 "$(dirname "$read_target_file")") ]]; then # If the override folder is empty
|
||||||
rmdir "$(dirname $read_target_file)"
|
rmdir "$(realpath "$(dirname "$read_target_file")")"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue