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,27 +309,29 @@ sanitize() {
exported=1 exported=1
fi fi
# Back up keybinds if message 3 "This helper will delete the following directory:\n\n$user_dir\n\nDo you want to proceed?"; then
if [ "$exported" -eq 1 ]; then # Back up keybinds
echo "Backing up all saved keybinds..." if [ "$exported" -eq 1 ]; then
cp -r "$mappings_dir/." "$backup_path/keybinds/" echo "Backing up all saved keybinds..."
cp -r "$mappings_dir/." "$backup_path/keybinds/"
echo -e "Done.\n"
fi
# Wipe the user directory
echo "Wiping USER directory..."
rm -r "$user_dir"
echo -e "Done.\n" echo -e "Done.\n"
fi
# Wipe the user directory
echo "Wiping USER directory..."
mv "$user_dir" "$backup_path/userbackup_$(date +"%Y%m%d-%H%M%S")"
echo -e "Done.\n"
# Restore custom keybinds # Restore custom keybinds
if [ "$exported" -eq 1 ]; then if [ "$exported" -eq 1 ]; then
echo "Restoring keybinds..." echo "Restoring keybinds..."
mkdir -p "$mappings_dir" && cp -r "$backup_path/keybinds/." "$mappings_dir/" mkdir -p "$mappings_dir" && cp -r "$backup_path/keybinds/." "$mappings_dir/"
echo -e "Done.\n" echo -e "Done.\n"
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
echo "Deleting shaders..." if message 3 "This helper will delete the following directory:\n\n$shaders_dir\n\nDo you want to proceed?"; then
rm -r "$shaders_dir" echo "Deleting shaders..."
echo -e "Done.\n" rm -r "$shaders_dir"
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
echo "Deleting DXVK cache..." if message 3 "This helper will delete the following file:\n\n$dxvk_cache\n\nDo you want to proceed?"; then
rm "$dxvk_cache" echo "Deleting DXVK cache..."
echo -e "Done.\n" rm "$dxvk_cache"
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)"