mirror of https://gitlab.com/basile.b/dexed.git
fixes for the linux version
This commit is contained in:
parent
0d7d51a0d8
commit
a9f68c1e66
|
|
@ -224,7 +224,7 @@ type
|
||||||
|
|
||||||
|
|
||||||
(**
|
(**
|
||||||
* Returns TRUE if EXEName is running under Windows or Linux
|
* Returns true if Exename is running under Windows or Linux
|
||||||
*)
|
*)
|
||||||
function AppIsRunning(const ExeName: string):Boolean;
|
function AppIsRunning(const ExeName: string):Boolean;
|
||||||
|
|
||||||
|
|
@ -865,7 +865,7 @@ begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$IFDEF WINDOWS}
|
{$IFDEF WINDOWS}
|
||||||
function WindowsAppIsRunning(const ExeName: string): integer;
|
function internalAppIsRunning(const ExeName: string): integer;
|
||||||
var
|
var
|
||||||
ContinueLoop: BOOL;
|
ContinueLoop: BOOL;
|
||||||
FSnapshotHandle: THandle;
|
FSnapshotHandle: THandle;
|
||||||
|
|
@ -889,38 +889,37 @@ begin
|
||||||
CloseHandle(FSnapshotHandle);
|
CloseHandle(FSnapshotHandle);
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{$IFDEF LINUX}
|
{$IFDEF LINUX}
|
||||||
function LinuxAppIsRunning(const ExeName: string): integer;
|
function internalAppIsRunning(const ExeName: string): integer;
|
||||||
var
|
var
|
||||||
t: TProcess;
|
proc: TProcess;
|
||||||
s: TStringList;
|
lst: TStringList;
|
||||||
begin
|
begin
|
||||||
Result := 0;
|
Result := 0;
|
||||||
t := tprocess.Create(nil);
|
proc := tprocess.Create(nil);
|
||||||
t.CommandLine := 'ps -C ' + ExeName;
|
proc.Executable := 'ps';
|
||||||
t.Options := [poUsePipes, poWaitonexit];
|
proc.Parameters.Add('-C');
|
||||||
|
proc.Parameters.Add(ExeName);
|
||||||
|
proc.Options := [poUsePipes, poWaitonexit];
|
||||||
try
|
try
|
||||||
t.Execute;
|
proc.Execute;
|
||||||
s := TStringList.Create;
|
lst := TStringList.Create;
|
||||||
try
|
try
|
||||||
s.LoadFromStream(t.Output);
|
lst.LoadFromStream(proc.Output);
|
||||||
Result := Pos(ExeName, s.Text);
|
Result := Pos(ExeName, lst.Text);
|
||||||
finally
|
finally
|
||||||
s.Free;
|
lst.Free;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
t.Free;
|
proc.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
function AppIsRunning(const ExeName: string):Boolean;
|
function AppIsRunning(const ExeName: string):Boolean;
|
||||||
begin
|
begin
|
||||||
{$IFDEF WINDOWS}
|
Result:= internalAppIsRunning(ExeName) > 0;
|
||||||
Result:=(WindowsAppIsRunning(ExeName) > 0);
|
|
||||||
{$ENDIF}
|
|
||||||
{$IFDEF LINUX}
|
|
||||||
Result:=(LinuxAppIsRunning(ExeName) > 0);
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,10 @@ unit ce_dcd;
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, process, forms, strutils, windows,
|
Classes, SysUtils, process, forms, strutils,
|
||||||
|
{$IFDEF WINDOWS}
|
||||||
|
windows,
|
||||||
|
{$ENDIF}
|
||||||
ce_common, ce_writableComponent, ce_interfaces, ce_observer, ce_synmemo, ce_project;
|
ce_common, ce_writableComponent, ce_interfaces, ce_observer, ce_synmemo, ce_project;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue