#!/usr/bin/env bash # ############################################################################## # Finds Steam games in your Steam directory and writes .desktop shortcuts to an # output directory. # ############################################################################## # Configuration readonly ROMS_DIR="${HOME}/RetroPie/roms" readonly OUTPUT_DIR="${ROMS_DIR}/steam" # Steam stuff readonly STEAM_APPS_DIR="${HOME}/.steam/steam/steamapps" readonly STEAM_MANIFEST_EXT='.acf' # ############################################################################## # Echoes the given property from the given manifest. # # Arguments: # app_manifest_path - The full path to the app manifest file from which the # property should be read. # property_name - The string name of the property to be read from the # given app manifest. # ############################################################################## function getManifestProperty() { local app_manifest_path="$1" local property_name="$2" echo $( grep "${property_name}" "${app_manifest_path}" \ | rev \ | cut -f 1 \ | rev \ | sed -e 's/"//g' ) } # ############################################################################## # Cats the contents of an XDG .desktop shortcut file for a Steam app. # # See: https://standards.freedesktop.org/desktop-entry-spec/latest/ar01s03.html # # Arguments: # app_id - The numeric ID for the Steam app. # app_name - The string name of the Steam app. # ############################################################################## function xdgDesktopTemplate() { local app_id="$1" local app_name="$2" cat < "${xdg_desktop_file_path}" chmod 755 "${xdg_desktop_file_path}" done