sane-open: more robust auto-application/file detection
This commit is contained in:
@@ -17,7 +17,7 @@ usage() {
|
|||||||
|
|
||||||
log() {
|
log() {
|
||||||
if [ -n "$SANE_OPEN_DEBUG" ]; then
|
if [ -n "$SANE_OPEN_DEBUG" ]; then
|
||||||
printf 'sane-open: %s\n' $@ >&2
|
printf 'sane-open: %s\n' "$1" >&2
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,9 +147,15 @@ if [ -z "$resourceType" ]; then
|
|||||||
if [ -e "$HOME/.local/share/applications/$resource" ]; then
|
if [ -e "$HOME/.local/share/applications/$resource" ]; then
|
||||||
log "detected resourceType=application"
|
log "detected resourceType=application"
|
||||||
resourceType=application
|
resourceType=application
|
||||||
else
|
elif [ -e "$resource" ]; then
|
||||||
log "detected resourceType=file"
|
log "detected resourceType=file"
|
||||||
resourceType=file
|
resourceType=file
|
||||||
|
elif [[ "$resource" == *.desktop ]]; then
|
||||||
|
log "detected resourceType=application (warning: '$resource' is not visible on disk)"
|
||||||
|
resourceType=application
|
||||||
|
else
|
||||||
|
log "detected resourceType=file (warning: '$resource' is not visible on disk)"
|
||||||
|
resourceType=file
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user