diff options
author | Slatian <baschdel@disroot.org> | 2024-06-08 12:43:34 +0000 |
---|---|---|
committer | Simon Lees <simon@simotek.net> | 2024-06-08 12:43:34 +0000 |
commit | 0f6385262417f1c0c4d13bc05d95c32578272b64 (patch) | |
tree | a47e40b0683e02df888cc41852b493a7cb0786b0 | |
parent | f113a8b997dcb9527b9694d31bddcfa05096aecf (diff) |
Error when trying to use xdg-mime default on a desktop file that doen't have a valid binaryHEADmaster
-rw-r--r-- | scripts/xdg-mime.in | 7 | ||||
-rw-r--r-- | scripts/xdg-utils-common.in | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/scripts/xdg-mime.in b/scripts/xdg-mime.in index f9c6bae..18056df 100644 --- a/scripts/xdg-mime.in +++ b/scripts/xdg-mime.in @@ -654,6 +654,13 @@ if [ "$action" = "makedefault" ]; then detectDE + binary="$(desktop_file_to_binary "$filename")" + if [ -z "$binary" ] ; then + echo "The given .desktop file doesn't exist or doesn't have an Exec key that points to a program." + echo "To get more information run with: XDG_UTILS_DEBUG_LEVEL=4 xdg-mime makedefault …" >&2 + exit_failure_file_missing + fi + while [ $# -gt 0 ] ; do case $1 in -*) diff --git a/scripts/xdg-utils-common.in b/scripts/xdg-utils-common.in index adab368..dff66d0 100644 --- a/scripts/xdg-utils-common.in +++ b/scripts/xdg-utils-common.in @@ -98,6 +98,10 @@ desktop_file_to_binary() print substr($2,RSTART,RLENGTH) }' \ < "$file_path" )" + if [ -z "$binary" ] ; then + DEBUG 2 "No or empty Exec key in .desktop file. Search failed." + return + fi DEBUG 2 "Found command: $binary" binary="$(xdg_which "$binary")" DEBUG 2 "Resolved to command to file: '$binary'" |