EmuDeck/tools/launcherFunctions.sh
Griffin 7b5bfd2743
move all /bin/sh and /usr/bin/bash to /bin/bash (#972)
Co-authored-by: Dragoon Dorise <rodrigosedano@me.com>
2024-01-30 21:07:58 +01:00

38 lines
741 B
Bash

#!/bin/bash
## launcherFunctions.sh
### Functions
# Report Errors
reportError () {
# Report error to logfile
echo "${1}" >> "${LOGFILE}"
# Open a Zenity dialog for the user
if [ "${2}" == "true" ]; then
zenity --error \
--text="${1}"\
--width=250
fi
# Exit the script
if [ "${3}" == "true" ]; then
exit 1
fi
}
# Check for file
checkFile () {
echo "Checking for file: ${1}" >> "${LOGFILE}"
if [ ! -f "${1}" ]; then
reportError "Error: Unable to find ${1##*/} in\n ${1%/*}" "true" "true"
fi
}
# Report all current arguments to the LOGFILE
showArguments () {
local arg
for arg; do
echo "Argument: $arg" >> "${LOGFILE}"
done
}