From 917b5fbb32e1abf818eca2dd293bdbcb733ce4ad Mon Sep 17 00:00:00 2001 From: Mitch Capper Date: Sun, 23 Apr 2023 05:10:22 -0700 Subject: [PATCH] Make sure the desktop folder exists before trying to write scheme to it --- grep+ | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/grep+ b/grep+ index c26ff84..aea4c86 100755 --- a/grep+ +++ b/grep+ @@ -59,7 +59,9 @@ declare -r HELP_PATH SCHEME_HANDLER_NAME="$SCRIPT_BIN_NAME" declare -r SCHEME_HANDLER_NAME -SCHEME_HANDLER_DESKTOP_FILE_PATH="$SYS_SHARE_PATH/applications/$SCHEME_HANDLER_NAME.desktop" +SCHEME_HANDLER_DESKTOP_DIR="$SYS_SHARE_PATH/applications" +declare -r SCHEME_HANDLER_DESKTOP_DIR +SCHEME_HANDLER_DESKTOP_FILE_PATH="$SCHEME_HANDLER_DESKTOP_DIR/$SCHEME_HANDLER_NAME.desktop" declare -r SCHEME_HANDLER_DESKTOP_FILE_PATH # Styles @@ -126,6 +128,9 @@ declare -r DEFAULT_FILE_PATH_FALLBACK # Add the custom scheme handler add_scheme() { + if [[ ! -d "$SCHEME_HANDLER_DESKTOP_DIR" ]]; then + return + fi cat <<- HEREDOC > "$SCHEME_HANDLER_DESKTOP_FILE_PATH" [Desktop Entry] Type=Application