mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-10 22:59:17 +02:00
IDE: started CheckCarbonProc
git-svn-id: trunk@31276 -
This commit is contained in:
parent
9fb8ba331a
commit
e2081bb160
@ -93,11 +93,12 @@ implementation
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$IF defined(FreeBSD) and defined(VER2_5)}
|
{$IF defined(FreeBSD) and defined(VER2_5)}
|
||||||
{$DEFINE UseFreeBSDKernProc}
|
{$DEFINE UseFreeBSDKernProc}
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{$IFDEF UseFreeBSDKernProc}
|
|
||||||
uses FreeBSD, BaseUnix;
|
uses FreeBSD, BaseUnix;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
{$IFDEF Darwin}
|
||||||
|
{$DEFINE UseCarbonProc}
|
||||||
|
uses MacOSAll, CarbonProc;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
function IsLazarusPIDRunning(aPID: int64): boolean;
|
function IsLazarusPIDRunning(aPID: int64): boolean;
|
||||||
|
|
||||||
@ -133,6 +134,28 @@ function IsLazarusPIDRunning(aPID: int64): boolean;
|
|||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF UseCarbonProc}
|
||||||
|
function CheckCarbonProc: boolean;
|
||||||
|
var
|
||||||
|
psn: ProcessSerialNumber;
|
||||||
|
info: ProcessInfoRec;
|
||||||
|
processName: CFStringRef;
|
||||||
|
s: String;
|
||||||
|
begin
|
||||||
|
Result:=false;
|
||||||
|
if GetProcessForPID(aPid,psn)=noErr then exit;
|
||||||
|
FillByte(info,SizeOf(info),0);
|
||||||
|
if GetProcessInformation(psn,info)=noErr then exit;
|
||||||
|
processName := nil;
|
||||||
|
if CopyProcessName(psn, processName)=noErr then exit;
|
||||||
|
if processName<>nil then begin
|
||||||
|
s:=CFStringToStr(processName);
|
||||||
|
CFRelease(processName);
|
||||||
|
Result:=Pos('lazarus',lowercase(s))>0;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result:=true;
|
Result:=true;
|
||||||
{$IFDEF UseFreeBSDKernProc}
|
{$IFDEF UseFreeBSDKernProc}
|
||||||
@ -141,6 +164,9 @@ begin
|
|||||||
{$IFDEF UseProcFileSystem}
|
{$IFDEF UseProcFileSystem}
|
||||||
if CheckProcFileSystem then exit;
|
if CheckProcFileSystem then exit;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
{$IFDEF UseCarbonProc}
|
||||||
|
if CheckCarbonProc then exit;
|
||||||
|
{$ENDIF}
|
||||||
Result:=false;
|
Result:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -218,22 +244,22 @@ end;
|
|||||||
function IsHelpRequested (index : Integer = 1) : Boolean;
|
function IsHelpRequested (index : Integer = 1) : Boolean;
|
||||||
begin
|
begin
|
||||||
Result := (ParamCount>=index) and
|
Result := (ParamCount>=index) and
|
||||||
((CompareText (ParamStrUTF8(index), '--help') = 0) or
|
((SysUtils.CompareText (ParamStrUTF8(index), '--help') = 0) or
|
||||||
(CompareText (ParamStrUTF8(index), '-help') = 0) or
|
(SysUtils.CompareText (ParamStrUTF8(index), '-help') = 0) or
|
||||||
(CompareText (ParamStrUTF8(index), '-?') = 0) or
|
(SysUtils.CompareText (ParamStrUTF8(index), '-?') = 0) or
|
||||||
(CompareText (ParamStrUTF8(index), '-h') = 0));
|
(SysUtils.CompareText (ParamStrUTF8(index), '-h') = 0));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function IsVersionRequested: boolean;
|
function IsVersionRequested: boolean;
|
||||||
begin
|
begin
|
||||||
Result := (ParamCount=1) and
|
Result := (ParamCount=1) and
|
||||||
((CompareText (ParamStrUTF8(1), '--version') = 0) or
|
((SysUtils.CompareText (ParamStrUTF8(1), '--version') = 0) or
|
||||||
(CompareText (ParamStrUTF8(1), '-v') = 0));
|
(SysUtils.CompareText (ParamStrUTF8(1), '-v') = 0));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function ParamIsOption(ParamIndex : integer; const Option : string) : boolean;
|
function ParamIsOption(ParamIndex : integer; const Option : string) : boolean;
|
||||||
begin
|
begin
|
||||||
Result:=CompareText(ParamStrUTF8(ParamIndex),Option) = 0;
|
Result:=SysUtils.CompareText(ParamStrUTF8(ParamIndex),Option) = 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function ParamIsOptionPlusValue(ParamIndex : integer;
|
function ParamIsOptionPlusValue(ParamIndex : integer;
|
||||||
@ -242,7 +268,7 @@ var
|
|||||||
p : String;
|
p : String;
|
||||||
begin
|
begin
|
||||||
p := ParamStrUTF8(ParamIndex);
|
p := ParamStrUTF8(ParamIndex);
|
||||||
Result := CompareText(LeftStr(p, length(Option)), Option) = 0;
|
Result := SysUtils.CompareText(LeftStr(p, length(Option)), Option) = 0;
|
||||||
if Result then
|
if Result then
|
||||||
AValue := copy(p, length(Option) + 1, length(p))
|
AValue := copy(p, length(Option) + 1, length(p))
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user