forked from pool/xdg-utils
Jiri Slaby
0ce2a2ff18
- Update to 20160520 * xdg-mime: support for KDE Frameworks 5.6 * xdg-mime does not write the file it reads in a query (BR95051) * xdg-screensaver: Add cinnamon-screensaver D-Bus API support. * xdg-open: standardize output redirection style - Fix issues related to xdg-open/xdg-mime generic code paths. * xdg-common-desktop-bin-vendor-dir.patch * xdg-mime-return-existing-desktop-files.patch OBS-URL: https://build.opensuse.org/request/show/400599 OBS-URL: https://build.opensuse.org/package/show/X11:common:Factory/xdg-utils?expand=0&rev=53
60 lines
2.2 KiB
Diff
60 lines
2.2 KiB
Diff
commit 6e4d88e740b89a2766312fb544e4a22b7034d9e3
|
|
Author: Simon Lees <sflees@suse.de>
|
|
Date: Tue May 31 13:13:53 2016 +0930
|
|
|
|
common: implement vendor dirs in desktop_file_to_binary
|
|
|
|
diff --git a/scripts/xdg-utils-common.in b/scripts/xdg-utils-common.in
|
|
index cf08cd3..19400a4 100644
|
|
--- a/scripts/xdg-utils-common.in
|
|
+++ b/scripts/xdg-utils-common.in
|
|
@@ -50,7 +50,6 @@ binary_to_desktop_file()
|
|
|
|
#-------------------------------------------------------------
|
|
# map a .desktop file to a binary
|
|
-## FIXME: handle vendor dir case
|
|
desktop_file_to_binary()
|
|
{
|
|
search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
|
|
@@ -58,14 +57,32 @@ desktop_file_to_binary()
|
|
IFS=:
|
|
for dir in $search; do
|
|
unset IFS
|
|
- [ "$dir" ] && [ -d "$dir/applications" ] || continue
|
|
- file="$dir/applications/$desktop"
|
|
- [ -r "$file" ] || continue
|
|
- # Remove any arguments (%F, %f, %U, %u, etc.).
|
|
- command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`"
|
|
- command="`which "$command"`"
|
|
- readlink -f "$command"
|
|
- return
|
|
+ [ "$dir" ] && [ -d "$dir/applications" ] || [ -d "$dir/applnk" ] || continue
|
|
+ # Check if desktop file contains -
|
|
+ if [ "${desktop#*-}" != "$desktop" ]; then
|
|
+ vendor=${desktop%-*}
|
|
+ app=${desktop#*-}
|
|
+ if [ -r $dir/applications/$vendor/$app ]; then
|
|
+ file_path=$dir/applications/$vendor/$app
|
|
+ elif [ -r $dir/applnk/$vendor/$app ]; then
|
|
+ file_path=$dir/applnk/$vendor/$app
|
|
+ fi
|
|
+ else
|
|
+ for indir in "$dir"/applications/ "$dir"/applications/*/ "$dir"/applnk/ "$dir"/applnk/*/; do
|
|
+ file="$indir/$desktop"
|
|
+ if [ -r "$file" ]; then
|
|
+ file_path=$file
|
|
+ break
|
|
+ fi
|
|
+ done
|
|
+ fi
|
|
+ if [ -r "$file_path" ]; then
|
|
+ # Remove any arguments (%F, %f, %U, %u, etc.).
|
|
+ command="`grep -E "^Exec(\[[^]=]*])?=" "$file_path" | cut -d= -f 2- | first_word`"
|
|
+ command="`which "$command"`"
|
|
+ readlink -f "$command"
|
|
+ return
|
|
+ fi
|
|
done
|
|
}
|
|
|