You can launch a program via file extension with both Windows and Mac, but I'm not aware of any standardized way to do this on Linux. You can see how the HelpUtil.pas in this toolkit does it with OS X and Linux:
http://wiki.lazarus.freepascal.org/XDev_Toolkit Thanks. -Phil -----Original Message----- From: Mark Morgan Lloyd [mailto:[EMAIL PROTECTED] Sent: Monday, December 10, 2007 7:12 AM To: lazarus@miraclec.com Subject: Re: [lazarus] Helpfiles for Lazarus apps A.J. Venter wrote: >> I was looking at the relevant source file yesterday and I noticed that if the >> location of the browser isn't specified it's found by brute force. When >> running under Win-32 I've used ShellExecuteEx() which automagically associates >> an http: prefix with an HTML viewer: does anybody know whether KDE etc. >> exposes an API (dcom/dbus etc.) that can do this? > > They all do, but none of them share it. > Gnome shares the default browser from gconf, kde you can use kfmclient > which will revert back to the configured one, every other desktop > doesn't do anything like that at all. Pretty much every file manager > not part of either gnome or KDE uses brute force or 'you have to > configure it' approach. > There was an attempt by ESR a few years ago to get a BROWSER > environment variable standardized, so all apps could simply refer to > $BROWSER and get the user's preferred default one. I have no idea why > it didn't take off, but it didn't - sad because it would have been an > ideal solution. > Perhaps the code should be expanded to check for the existence of > $BROWSER first, and THEN start brute-forcing command names ? Other > than that, it really cannot be much better than it is. Sorry. Thanks for that, interesting. Actually I'm looking at a slightly wider problem which is how to know what program to invoke in order to open any file: using Win-32 ShellExecuteEx() I can pass a file name with either a known suffix (.txt) or a known scheme (http:) and a suitable program is started, similarly with KDE and presumably also with Gnome. The test app that I'm recoding to "get into" Lazarus has a couple of right-button options: one of them treats highlighted text as a file name and opens it using another instance of the same program, the other treats it as a command and executes it. Under Win-32 the command can have a .txt suffix which opens whatever editor is associated, an http: scheme which opens the default browser and so on, it would be nice to be able to duplicate this functionality even if it was limited to desktops which conform to freedesktop.org. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] _________________________________________________________________ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives _________________________________________________________________ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives