For a while now I was using a simple command line utility in Gnome called gnome-open. As an argument you can pass a url, a file or a folder. Urls will be opened in your browser, files with the associated applications and folders in Nautilus.
This is great for applications or menu entries as well. If you want to open a PDF document you can use gnome-open in order to make sure that it is opened using the user's preferred viewer.
This is all nice and dandy until you want to package an application that could be run under some other desktop environment. There is no gnome-open under KDE. What can you do in this case?
If you want to be desktop environment agnostic the you can use xdg-open. Unfortunately it is not installed by default in Ubuntu, it is part of a package called xdg-utils, you can add this as a dependency of your own package if you are using it in your app.
Technorati Tags: 


