Find the associated program for a file type in Linux and Darwin. lazarus / 31-LCL ---------------------------------------------------------------------- cookie22 · 2013-08-15 18:49 Hello, I need to run a file in the associated program and wait for the end of the program to work with the changed file again. So I can't use "open" or "xdg-open". Is there any way to find out the associaed program name in Linux and darwin that I can  use TProcess for it? ---------------------------------------------------------------------- typo · 2013-08-15 19:31 OpenDocument? http://lazarus-ccr.sourceforge.net/docs/lcl/lclintf/opendocument.html ---------------------------------------------------------------------- cookie22 · 2013-08-15 19:48 OpenDocument uses "open" or "xdg-open", as I wrote I need to wait for the program to stop. So open Document does not help. I need something like ShellExecuteEx + waitforsingleobject or I need to find a way to get the associated program then I can use TProcess + poWaitOnExit. ---------------------------------------------------------------------- Leledumbo · 2013-08-15 21:54 Linux only: You can use fpmimetypes to get mimetype of the file (based on file extension though) and then look for matching entries in mimeapps.list or defaults.list (use locate to find these files) which could be simplified using TIniFile since they're formatted as such. The right hand side is a .desktop entries which again, you have to search in $XDG_DATA_DIRS/applications (multiple, separated by ":"), open the .desktop file (TIniFile strikes again here) and execute the command in exec entry.