From 3a48d52e34f033ddf54e732749032c84e79825d6 Mon Sep 17 00:00:00 2001 From: KKV9 Date: Sun, 28 Jan 2024 17:25:01 +0000 Subject: [PATCH] Handle file not found error Add exit code 1 when no suitable file is found --- config/hypr/UserScripts/Sounds.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/config/hypr/UserScripts/Sounds.sh b/config/hypr/UserScripts/Sounds.sh index 1bcb181..d7f08e4 100755 --- a/config/hypr/UserScripts/Sounds.sh +++ b/config/hypr/UserScripts/Sounds.sh @@ -45,6 +45,11 @@ else elif test -f "$userDIR/$defaultTheme/$soundoption"; then pw-play "$userDIR/$defaultTheme/$soundoption" else - pw-play "$systemDIR/$defaultTheme/$soundoption" + if test -f "$systemDIR/$defaultTheme/$soundoption"; then + pw-play "$systemDIR/$defaultTheme/$soundoption" + else + echo "Error: Sound file not found." + exit 1 + fi fi fi