From 589621f43e3df74bf569873835adaabfcc5de952 Mon Sep 17 00:00:00 2001 From: the-sane <3657071+the-sane@users.noreply.github.com> Date: Tue, 11 Aug 2020 22:46:05 -0400 Subject: [PATCH] Additional sanity checks --- lug-helper.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lug-helper.sh b/lug-helper.sh index e735408..eb0c26a 100644 --- a/lug-helper.sh +++ b/lug-helper.sh @@ -244,11 +244,20 @@ sanitize() { # Get/Set directory paths getdirs + # Sanity check + if [ ! -d "$user_dir" ]; then + message 2 "Directory not found. The script will now exit.\n$user_dir" + exit 0 + fi + # Check for exported keybind files - exported=0 # Default to none found if [ ! -d "$mappings_dir" ] || [ -z "$(ls -A "$mappings_dir")" ]; then - message 1 "Warning: No exported keybindings found. Keybinds will not be backed up!" - exported=0 + if message 3 "Warning: No exported keybindings found. Keybinds will not be backed up!\n\nDo you want to continue anyway?"; then + exported=0 + else + message 2 "The script will now exit." + exit 0 + fi else exported=1 fi