diff options
Diffstat (limited to 'scripts')
-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'" |