Additional sanity checks

This commit is contained in:
the-sane 2020-08-11 22:46:05 -04:00 committed by GitHub
parent 54202fc5ba
commit 589621f43e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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!"
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