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 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() { download() {
local source=($@) local source=($@)
for i in "${source[@]}" ; do for i in "${source[@]}" ; do
@ -489,7 +509,7 @@ gameList=(
"Swamp" "Swamp"
"Technoshock" "Technoshock"
"The Blind Swordsman" "The Blind Swordsman"
#"The Gate" "The Gate"
"The Great Toy Robbery" "The Great Toy Robbery"
#"Three D velocity" #"Three D velocity"
"Top Speed 3" "Top Speed 3"
@ -505,6 +525,7 @@ fi
# Array of command line arguments # Array of command line arguments
declare -A command=( declare -A command=(
[c]="Check your system for necessary components." [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." [d]="Debug mode, wine will be much more verbose when games are launched with this flag."
[h]="This help screen." [h]="This help screen."
[i]="Install games." [i]="Install games."
@ -520,6 +541,7 @@ args="${args//[[:space:]]/}"
while getopts "${args}" i ; do while getopts "${args}" i ; do
case "$i" in case "$i" in
c) checklist;; c) checklist;;
C) clear_cache;;
d) d)
unset WINEDEBUG unset WINEDEBUG
game_launcher game_launcher