diff options
author | Graeme Geldenhuys <graemeg@gmail.com> | 2013-04-03 14:51:47 +0100 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@gmail.com> | 2013-04-04 23:00:56 +0100 |
commit | 590c0c64dab7ccef65eb449d8cb80f3baf58beb6 (patch) | |
tree | 6d30aa37de4719f71f02706fe69eb7723253b32c /src/corelib | |
parent | de7e463e6210c28b56ba853ec2c2fdfd404a7a1f (diff) | |
download | fpGUI-590c0c64dab7ccef65eb449d8cb80f3baf58beb6.tar.xz |
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.
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/fpg_base.pas | 12 | ||||
-rw-r--r-- | src/corelib/x11/fpg_x11.pas | 13 |
2 files changed, 23 insertions, 2 deletions
diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas index 5158540e..bf9cf9b9 100644 --- a/src/corelib/fpg_base.pas +++ b/src/corelib/fpg_base.pas @@ -2607,7 +2607,11 @@ var p: TProcess; begin Result := False; - if not fpgFileExists(GetHelpViewer) then + if fpgExtractFilePath(GetHelpViewer) = '' then + begin + // do nothing - we are hoping docview is in the system PATH + end + else if not fpgFileExists(GetHelpViewer) then raise EfpGUIUserFeedbackException.Create(rsfailedtofindhelpviewer); p := TProcess.Create(nil); try @@ -2633,7 +2637,11 @@ var p: TProcess; begin Result := False; - if not fpgFileExists(GetHelpViewer) then + if fpgExtractFilePath(GetHelpViewer) = '' then + begin + // do nothing - we are hoping docview is in the system PATH + end + else if not fpgFileExists(GetHelpViewer) then raise EfpGUIUserFeedbackException.Create(rsfailedtofindhelpviewer); p := TProcess.Create(nil); try 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; |