A few more tweaks to the documentation functionality.

This commit is contained in:
Storm Dragon 2021-04-27 21:39:15 -04:00
parent 143790910f
commit 023fc8de32

View File

@ -286,21 +286,21 @@ echo "Loading documentation, please wait..."
# Try to find documentation based on common naming conventions.
local gamePath="$(winepath -u "$2" 2> /dev/null)"
gamePath="${gamePath%/*}"
local gameDoc="$(find "$gamePath" -type f -iname 'user_manual.html')"
local gameDoc="$(find "$gamePath" -type f -iname 'user_manual.html' | head -1)"
if [[ -z "$gameDoc" ]]; then
gameDoc="$(find "$gamePath" -type f -iname 'manual.html')"
gameDoc="$(find "$gamePath" -type f -iname 'manual.html' | head -1)"
fi
if [[ -z "$gameDoc" ]]; then
gameDoc="$(find "$gamePath" -type f -iname 'readme.html')"
gameDoc="$(find "$gamePath" -type f -iname 'readme.html' | head -1)"
fi
if [[ -z "$gameDoc" ]]; then
gameDoc="$(find "$gamePath" -type f -iname 'manual.txt')"
gameDoc="$(find "$gamePath" -type f -iname 'manual.txt' | head -1)"
fi
if [[ -z "$gameDoc" ]]; then
gameDoc="$(find "$gamePath" -type f -iname 'readme.txt')"
gameDoc="$(find "$gamePath" -type f -iname 'readme.txt' | head -1)"
fi
if [[ -z "$gameDoc" ]]; then
gameDoc="$(find "$gamePath" -type f -iname '*.url' -exec grep -i 'url=' {} \;)"
gameDoc="$(find "$gamePath" -type f -iname '*.url' -exec grep -i 'url=' {} \; | grep -iv 'score' | head -1)"
gameDoc="${gameDoc#*=}"
gameDoc="${gameDoc//[[:cntrl:]]/}"
fi