mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 09:19:40 +02:00
40 lines
977 B
PHP
40 lines
977 B
PHP
{%MainUnit ../lclintf.pas}
|
|
|
|
// Locates the default browser associated in the system
|
|
|
|
function FindBrowserExecutable(const ShortFilename: String; out ABrowser: String): Boolean; inline;
|
|
begin
|
|
ABrowser := SearchFileInPath(ShortFilename + GetExeExt, '',
|
|
GetEnvironmentVariableUTF8('PATH'), PathSeparator,
|
|
[sffDontSearchInBasePath]);
|
|
Result := (ABrowser <> '');
|
|
end;
|
|
|
|
const
|
|
PredefinedBrowserStrings: array[1..11] of String = (
|
|
'xdg-open',
|
|
'htmlview',
|
|
'firefox',
|
|
'mozilla',
|
|
'google-chrome',
|
|
'galeon',
|
|
'konqueror',
|
|
'safari',
|
|
'netscape',
|
|
'opera',
|
|
'iexplore'
|
|
);
|
|
|
|
function FindPredefinedBrowser(out ABrowser, AParams: String): Boolean;
|
|
var
|
|
i: Integer;
|
|
begin
|
|
ABrowser := '';
|
|
AParams := '"%s"';
|
|
for i := Low(PredefinedBrowserStrings) to High(PredefinedBrowserStrings) do
|
|
if FindBrowserExecutable(PredefinedBrowserStrings[i], ABrowser) then Break;
|
|
Result := (ABrowser <> '');
|
|
end;
|
|
|
|
|