[Lazarus] Cross platform 'open file with default program'

Graeme Geldenhuys graemeg.lists at gmail.com
Sun Jan 24 07:54:17 CET 2010

2010/1/24 Luiz Americo Pereira Camara <luizmed at oi.com.br>:
> Does someone implemented a  function to open the system default app
> associated of a given file type? Similar to OpenURL?

Under Linux with distros supporting the freedesktop.org standards you
can execute the 'xdg-open' command. This will use the mime-type and
the each users preference on that system. This works for URL's too.

If the distro doesn't support xdg, I recommend you email the
maintainers of that distor. Also xdg tools are downloadable from
freedesktop.org, is small and user installable (without root access).

Anyway, in my projects I have abstracted various platforms into a
single command, similar to OpenURL. Our projects only need to support
Linux and Windows though, so I don't know the solutions for other

  - Graeme -

fpGUI - a cross-platform Free Pascal GUI toolkit

More information about the Lazarus mailing list