From 590c0c64dab7ccef65eb449d8cb80f3baf58beb6 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Wed, 3 Apr 2013 14:51:47 +0100 Subject: launching help viewer Under *nix systems, if we can't find the direct location of docview, we try the 'which docview' command. If we get a positive response, we know docview is in the system path, and we can go ahead and launch it. At least this doesn't instantly throw an exception when docview can't be found on the first attempt. --- src/corelib/x11/fpg_x11.pas | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/corelib/x11/fpg_x11.pas') diff --git a/src/corelib/x11/fpg_x11.pas b/src/corelib/x11/fpg_x11.pas index 20974dfe..37b2b469 100644 --- a/src/corelib/x11/fpg_x11.pas +++ b/src/corelib/x11/fpg_x11.pas @@ -322,6 +322,7 @@ type function DoGetFontFaceList: TStringList; override; procedure DoWaitWindowMessage(atimeoutms: integer); override; function MessagesPending: boolean; override; + function GetHelpViewer: TfpgString; override; public constructor Create(const AParams: string); override; destructor Destroy; override; @@ -420,6 +421,7 @@ implementation uses baseunix, + unix, {$IFDEF LINUX} users, { For Linux user and group name support. FPC only supports this in Linux. } {$ENDIF} @@ -430,6 +432,7 @@ uses fpg_utils, fpg_form, // for modal event support fpg_cmdlineparams, + fpg_constants, cursorfont, xatom, // used for XA_WM_NAME keysym, @@ -1433,6 +1436,16 @@ begin fpgCheckTimers; end; +function TfpgX11Application.GetHelpViewer: TfpgString; +begin + Result := inherited GetHelpViewer; + if not fpgFileExists(Result) then + begin + if fpsystem('which ' + FPG_HELPVIEWER) = 0 then + Result := FPG_HELPVIEWER; + end; +end; + function GetParentWindow(wh: TfpgWinHandle; var pw, rw: TfpgWinHandle): boolean; var rootw: TfpgWinHandle; -- cgit v1.2.3-70-g09d2