mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2025-04-10 19:15:12 +00:00
Replace xmlstarlet with AWK for finding faves in gamelists to avoid broken XML syntax when system-level altemu is set.
This commit is contained in:
parent
6030fa57b8
commit
a53cf917a3
|
|
@ -38,7 +38,12 @@ steam_sync() {
|
||||||
fi
|
fi
|
||||||
system=$(basename "$system_path") # Extract the folder name as the system name
|
system=$(basename "$system_path") # Extract the folder name as the system name
|
||||||
gamelist="${system_path}gamelist.xml"
|
gamelist="${system_path}gamelist.xml"
|
||||||
system_favorites=$(xml sel -t -m "//game[favorite='true']" -v "path" -n "$gamelist")
|
# Use AWK instead of xmlstarlet because ES-DE can create invalid XML structures in some cases
|
||||||
|
system_favorites=$(awk 'BEGIN { RS="</game>"; FS="\n" }
|
||||||
|
/<favorite>true<\/favorite>/ {
|
||||||
|
if (match($0, /<path>([^<]+)<\/path>/, arr))
|
||||||
|
print arr[1]
|
||||||
|
}' "$gamelist"
|
||||||
while read -r game; do
|
while read -r game; do
|
||||||
if [[ -n "$game" ]]; then # Avoid empty lines created by xmlstarlet
|
if [[ -n "$game" ]]; then # Avoid empty lines created by xmlstarlet
|
||||||
local game="${game#./}" # Remove leading ./
|
local game="${game#./}" # Remove leading ./
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue