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