mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 00:54:03 +02:00
chmhelp: on darwin use open -n to start lhelp in the foreground
git-svn-id: trunk@38058 -
This commit is contained in:
parent
5f012e16ba
commit
6f525d3316
@ -112,21 +112,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TChmHelpViewer.GetHelpEXE: String;
|
function TChmHelpViewer.GetHelpEXE: String;
|
||||||
{$IFDEF darwin}
|
|
||||||
var
|
|
||||||
Filename: String;
|
|
||||||
{$ENDIF}
|
|
||||||
begin
|
begin
|
||||||
Result:=fHelpExe;
|
Result:=fHelpExe;
|
||||||
if Result='' then
|
if Result='' then
|
||||||
Result := SetDirSeparators('$(LazarusDir)/components/chmhelp/lhelp/lhelp$(ExeExt)');
|
Result := SetDirSeparators('$(LazarusDir)/components/chmhelp/lhelp/lhelp$(ExeExt)');
|
||||||
if not IDEMacros.SubstituteMacros(Result) then
|
if not IDEMacros.SubstituteMacros(Result) then
|
||||||
Exit('');
|
Exit('');
|
||||||
{$IFDEF darwin}
|
|
||||||
Filename:=Result+'.app/Contents/MacOS/'+ExtractFileName(Result);
|
|
||||||
if FileExistsUTF8(Filename) then
|
|
||||||
Result:=Filename;
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TChmHelpViewer.GetHelpFilesPath: String;
|
function TChmHelpViewer.GetHelpFilesPath: String;
|
||||||
@ -352,6 +343,7 @@ var
|
|||||||
SearchPath: String;
|
SearchPath: String;
|
||||||
Proc: TProcessUTF8;
|
Proc: TProcessUTF8;
|
||||||
FoundFileName: String;
|
FoundFileName: String;
|
||||||
|
LHelpPath: String;
|
||||||
begin
|
begin
|
||||||
if Pos('file://', Node.URL) = 1 then
|
if Pos('file://', Node.URL) = 1 then
|
||||||
begin
|
begin
|
||||||
@ -384,7 +376,7 @@ begin
|
|||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
FileName := FoundFileName;
|
FileName := CleanAndExpandFilename(FoundFileName);
|
||||||
|
|
||||||
if ExtractFileNameOnly(GetHelpExe) = 'lhelp' then begin
|
if ExtractFileNameOnly(GetHelpExe) = 'lhelp' then begin
|
||||||
fHelpConnection.StartHelpServer(HelpLabel, GetHelpExe);
|
fHelpConnection.StartHelpServer(HelpLabel, GetHelpExe);
|
||||||
@ -408,7 +400,21 @@ begin
|
|||||||
{$if (fpc_version=2) and (fpc_release<5)}
|
{$if (fpc_version=2) and (fpc_release<5)}
|
||||||
Proc.CommandLine := GetHelpExe + ' ' + Format(fHelpExeParams, [FileName, Url]);
|
Proc.CommandLine := GetHelpExe + ' ' + Format(fHelpExeParams, [FileName, Url]);
|
||||||
{$else}
|
{$else}
|
||||||
Proc.Executable := GetHelpExe;
|
LHelpPath:=GetHelpEXE;
|
||||||
|
Proc.Executable := LHelpPath;
|
||||||
|
{$IFDEF darwin}
|
||||||
|
if DirectoryExistsUTF8(LHelpPath+'.app') then
|
||||||
|
LHelpPath+='.app';
|
||||||
|
if DirectoryExistsUTF8(LHelpPath) then begin
|
||||||
|
// application bundle
|
||||||
|
// to put lhelp into the foreground, use "open -n lhelp.app --args args"
|
||||||
|
Proc.Executable := '/usr/bin/open';
|
||||||
|
Proc.Parameters.Add('-n');
|
||||||
|
Proc.Parameters.Add(LHelpPath);
|
||||||
|
Proc.Parameters.Add('--args');
|
||||||
|
Proc.Parameters.Add(Format(fHelpExeParams, [FileName, Url]));
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
Proc.Parameters.Add(Format(fHelpExeParams, [FileName, Url]));
|
Proc.Parameters.Add(Format(fHelpExeParams, [FileName, Url]));
|
||||||
{$endif}
|
{$endif}
|
||||||
Proc.Execute;
|
Proc.Execute;
|
||||||
|
Loading…
Reference in New Issue
Block a user