Prompt before delete

This commit is contained in:
the-sane 2020-08-23 10:01:38 -04:00 committed by GitHub
parent aec8e171a2
commit 26351b50c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -309,6 +309,7 @@ sanitize() {
exported=1 exported=1
fi fi
if message 3 "This helper will delete the following directory:\n\n$user_dir\n\nDo you want to proceed?"; then
# Back up keybinds # Back up keybinds
if [ "$exported" -eq 1 ]; then if [ "$exported" -eq 1 ]; then
echo "Backing up all saved keybinds..." echo "Backing up all saved keybinds..."
@ -318,7 +319,7 @@ sanitize() {
# Wipe the user directory # Wipe the user directory
echo "Wiping USER directory..." echo "Wiping USER directory..."
mv "$user_dir" "$backup_path/userbackup_$(date +"%Y%m%d-%H%M%S")" rm -r "$user_dir"
echo -e "Done.\n" echo -e "Done.\n"
# Restore custom keybinds # Restore custom keybinds
@ -329,7 +330,8 @@ sanitize() {
message 1 "To re-import your keybinds, select it in-game from the list:\nOptions->Keybindings->Control Profiles" message 1 "To re-import your keybinds, select it in-game from the list:\nOptions->Keybindings->Control Profiles"
fi fi
message 1 "Your USER directory has been cleaned up!" message 1 "Your Star Citizen USER directory has been cleaned up!"
fi
} }
# Check if setting vm.max_map_count was successful # Check if setting vm.max_map_count was successful
@ -467,11 +469,12 @@ rm_shaders() {
fi fi
# Delete the shader directory # Delete the shader directory
if message 3 "This helper will delete the following directory:\n\n$shaders_dir\n\nDo you want to proceed?"; then
echo "Deleting shaders..." echo "Deleting shaders..."
rm -r "$shaders_dir" rm -r "$shaders_dir"
echo -e "Done.\n" echo -e "Done.\n"
message 1 "Your shaders have been deleted!" message 1 "Your shaders have been deleted!"
fi
} }
# Delete DXVK cache # Delete DXVK cache
@ -492,11 +495,12 @@ rm_vidcache() {
fi fi
# Delete the cache file # Delete the cache file
if message 3 "This helper will delete the following file:\n\n$dxvk_cache\n\nDo you want to proceed?"; then
echo "Deleting DXVK cache..." echo "Deleting DXVK cache..."
rm "$dxvk_cache" rm "$dxvk_cache"
echo -e "Done.\n" echo -e "Done.\n"
message 1 "Your DXVK cache has been deleted!" message 1 "Your DXVK cache has been deleted!"
fi
} }
# Toggle between targeting the LIVE and PTU game directories for all helper functions # Toggle between targeting the LIVE and PTU game directories for all helper functions
@ -518,7 +522,7 @@ main_menu() {
# Set the menu options # Set the menu options
mapcount_msg="Check vm.max_map_count for optimal performance" mapcount_msg="Check vm.max_map_count for optimal performance"
filelimit_msg="Check my open file descriptors limit" filelimit_msg="Check my open file descriptors limit"
sanitize_msg="Delete my USER folder and preserve my keybinds" sanitize_msg="Delete my Star Citizen USER folder and preserve my keybinds"
shaders_msg="Delete my shaders only" shaders_msg="Delete my shaders only"
vidcache_msg="Delete my DXVK cache" vidcache_msg="Delete my DXVK cache"
version_msg="Switch the helper between LIVE and PTU (default is LIVE)" version_msg="Switch the helper between LIVE and PTU (default is LIVE)"