|
|
@ -166,7 +166,7 @@ get_mime_type() { |
|
|
|
if [ -r "$1" ]; then |
|
|
|
if [ -r "$1" ]; then |
|
|
|
mime_type="$(file -b --mime-type "$1")" |
|
|
|
mime_type="$(file -b --mime-type "$1")" |
|
|
|
else |
|
|
|
else |
|
|
|
echo "This file does not exists?" > /dev/stderr |
|
|
|
echo "This file does not exists?" >&2 |
|
|
|
exit 1 |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
@ -185,8 +185,8 @@ get_mime_type() { |
|
|
|
|
|
|
|
|
|
|
|
execute() { |
|
|
|
execute() { |
|
|
|
if [ -n "$debug" ]; then |
|
|
|
if [ -n "$debug" ]; then |
|
|
|
echo "The final command to execute is:" > /dev/stderr |
|
|
|
echo "The final command to execute is:" >&2 |
|
|
|
echo "$@" > /dev/stderr |
|
|
|
echo "$@" >&2 |
|
|
|
exit 0 |
|
|
|
exit 0 |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
@ -195,7 +195,7 @@ execute() { |
|
|
|
|
|
|
|
|
|
|
|
fetch_file() { |
|
|
|
fetch_file() { |
|
|
|
if [ -n "$debug" ]; then |
|
|
|
if [ -n "$debug" ]; then |
|
|
|
echo "The file would be downloaded with '$*'" > /dev/stderr |
|
|
|
echo "The file would be downloaded with '$*'" >&2 |
|
|
|
return |
|
|
|
return |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
@ -260,7 +260,7 @@ run_desktop() { |
|
|
|
|
|
|
|
|
|
|
|
desktop_path="$(find_desktop_path "$desktop")" |
|
|
|
desktop_path="$(find_desktop_path "$desktop")" |
|
|
|
if [ -z "$desktop_path" ]; then |
|
|
|
if [ -z "$desktop_path" ]; then |
|
|
|
echo "We can't find the desktop file \"$desktop\"" > /dev/stderr |
|
|
|
echo "We can't find the desktop file \"$desktop\"" >&2 |
|
|
|
return |
|
|
|
return |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
@ -276,9 +276,9 @@ run_desktop() { |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
if [ -n "$debug" ]; then |
|
|
|
if [ -n "$debug" ]; then |
|
|
|
echo "Exec is \"$exec\"" > /dev/stderr |
|
|
|
echo "Exec is \"$exec\"" >&2 |
|
|
|
echo "Terminal is \"$terminal\"" > /dev/stderr |
|
|
|
echo "Terminal is \"$terminal\"" >&2 |
|
|
|
echo "Command is \"$command\"" > /dev/stderr |
|
|
|
echo "Command is \"$command\"" >&2 |
|
|
|
exit 0 |
|
|
|
exit 0 |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
@ -291,20 +291,20 @@ run() { |
|
|
|
mime_type="$(get_mime_type "$1")" |
|
|
|
mime_type="$(get_mime_type "$1")" |
|
|
|
|
|
|
|
|
|
|
|
if [ -z "$mime_type" ]; then |
|
|
|
if [ -z "$mime_type" ]; then |
|
|
|
echo "We failed to find the mime_type for \"$1\"" > /dev/stderr |
|
|
|
echo "We failed to find the mime_type for \"$1\"">&2 |
|
|
|
exit 1 |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
desktops="$(get_mimeapps_mapping | filter_matching_desktops "$mime_type")" |
|
|
|
desktops="$(get_mimeapps_mapping | filter_matching_desktops "$mime_type")" |
|
|
|
|
|
|
|
|
|
|
|
if [ -n "$debug" ]; then |
|
|
|
if [ -n "$debug" ]; then |
|
|
|
echo "The mime type is \"$mime_type\"" > /dev/stderr |
|
|
|
echo "The mime type is \"$mime_type\"" >&2 |
|
|
|
echo "The matching desktops are:" > /dev/stderr |
|
|
|
echo "The matching desktops are:" >&2 |
|
|
|
echo "$desktops" > /dev/stderr |
|
|
|
echo "$desktops" >&2 |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
if [ -z "$desktops" ]; then |
|
|
|
if [ -z "$desktops" ]; then |
|
|
|
echo "There is no matching desktop to open \"$mime_type\"" > /dev/stderr |
|
|
|
echo "There is no matching desktop to open \"$mime_type\"" >&2 |
|
|
|
exit 1 |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|