Can anyone suggest a sane use-case where a .desktop file needs to specify an arbitrary executable? I would have thought that in 99% of the uses of these things they should indicate their MIME type (or equivalent) and the desktop should use that to determine the executable to run.
(I suppose that still leaves MIME types like text/perl to worry about.)
Posted Feb 12, 2009 9:52 UTC (Thu) by roblucid (subscriber, #48964)
[Link]
That's the essential point. The desktop files saved should be data, that make requests of program interpreter's installed out of band. Then you need to have those data interpreters not have embedded script facilities within them, or ways to execute binary code in the data file.
Unfortunately it seems to be very tempting, to add "kool" dynamic content, by using over-general languages because it ticks the maximum number of feature lists.
Why arbitrary executables?
Posted Feb 12, 2009 19:58 UTC (Thu) by GhePeU (subscriber, #56133)
[Link]
Can anyone suggest a sane use-case where a .desktop file needs to specify an arbitrary executable? I would have thought that in 99% of the uses of these things they should indicate their MIME type (or equivalent) and the desktop should use that to determine the executable to run.
You got it backwards: the .desktop files are what the system use to decide what executable must be used to open a file with a specific MIME type.
When nautilus finds a file with the mimetype 'text/plain' it looks through all the .desktop files in the system- and user-specific directories until it finds one who lists the correct mimetype and launch the indicated executable with the specified parameter.
To gnome-menus the same file means "add to the Accessories menu an entry named 'Text Editor' with the tooltip 'Edit text files' and the icon 'accessories-text-editor', then if the user click on this entry launch the command 'gedit'".
A .desktop file needs to specify an arbitrary executable.