RUN_GAME: escaping '

This commit is contained in:
XargonWan 2024-09-18 15:35:56 +09:00
parent 59cdee5e87
commit 5e160325ab

View file

@ -168,6 +168,7 @@ find_system_commands() {
substitute_placeholders() { substitute_placeholders() {
local cmd="$1" local cmd="$1"
log d "Substitute placeholder: working on $cmd" log d "Substitute placeholder: working on $cmd"
game=$(echo "$game" | sed "s/'/'\\\\''/g") # escaping internal '
local rom_path="$game" local rom_path="$game"
local rom_dir=$(dirname "$rom_path") local rom_dir=$(dirname "$rom_path")
@ -193,6 +194,8 @@ substitute_placeholders() {
cmd="${cmd//"%FILENAME%"/"'$file_name'"}" cmd="${cmd//"%FILENAME%"/"'$file_name'"}"
cmd="${cmd//"%ROMRAW%"/"'$rom_raw'"}" cmd="${cmd//"%ROMRAW%"/"'$rom_raw'"}"
cmd="${cmd//"%ROMPATH%"/"'$rom_dir'"}" cmd="${cmd//"%ROMPATH%"/"'$rom_dir'"}"
cmd="${cmd//"%ENABLESHORTCUTS%"/""}"
cmd="${cmd//"%EMULATOR_OS-SHELL%"/"/bin/sh"}"
# Ensure paths are quoted correctly # Ensure paths are quoted correctly
cmd="${cmd//"%ROM%"/"'$rom_path'"}" cmd="${cmd//"%ROM%"/"'$rom_path'"}"