Added clear cache option.

This commit is contained in:
Storm Dragon 2020-12-16 23:28:38 -05:00
parent 087cec8681
commit dc53aff8ac

View File

@ -209,6 +209,26 @@ checklist() {
exit 0
}
clear_cache() {
local answer
if [[ ! -d "${cache}" ]]; then
echo "No cache found at ${cache}."
return
fi
while ! [[ "${answer,,}" =~ ^yes$|^no$ ]]; do
echo "This will delete all contents of ${cache}. Are you sure you want to continue?"
echo "Please type yes or no."
echo
read -r answer
done
if [[ "$answer" == "no" ]]; then
return
fi
# All safety checks done. Delete the cache.
rm -rfv "${cache}"
echo "Cache deleted."
}
download() {
local source=($@)
for i in "${source[@]}" ; do
@ -489,7 +509,7 @@ gameList=(
"Swamp"
"Technoshock"
"The Blind Swordsman"
#"The Gate"
"The Gate"
"The Great Toy Robbery"
#"Three D velocity"
"Top Speed 3"
@ -505,6 +525,7 @@ fi
# Array of command line arguments
declare -A command=(
[c]="Check your system for necessary components."
[C]="Clear the cache. All game installers will be deleted."
[d]="Debug mode, wine will be much more verbose when games are launched with this flag."
[h]="This help screen."
[i]="Install games."
@ -520,6 +541,7 @@ args="${args//[[:space:]]/}"
while getopts "${args}" i ; do
case "$i" in
c) checklist;;
C) clear_cache;;
d)
unset WINEDEBUG
game_launcher