mirror of https://gitlab.com/basile.b/dexed.git
Add `Open` function.
Trim will do the trick of obtaining the pid. No need for RemoveLeadingChars.
This commit is contained in:
parent
30b8a74929
commit
42aa1e67eb
|
@ -659,6 +659,18 @@ begin
|
||||||
Free;
|
Free;
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
{$IFDEF DARWIN}
|
||||||
|
with TProcess.Create(nil) do
|
||||||
|
try
|
||||||
|
Executable := 'open';
|
||||||
|
Parameters.Add(aFilename);
|
||||||
|
Execute;
|
||||||
|
finally
|
||||||
|
result := true;
|
||||||
|
Free;
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function exeInSysPath(anExeName: string): boolean;
|
function exeInSysPath(anExeName: string): boolean;
|
||||||
|
@ -916,11 +928,8 @@ function internalAppIsRunning(const ExeName: string): integer;
|
||||||
var
|
var
|
||||||
proc: TProcess;
|
proc: TProcess;
|
||||||
lst: TStringList;
|
lst: TStringList;
|
||||||
stripChars: TSysCharSet;
|
|
||||||
lstText: AnsiString;
|
|
||||||
begin
|
begin
|
||||||
Result := 0;
|
Result := 0;
|
||||||
stripChars := ['"'];
|
|
||||||
proc := tprocess.Create(nil);
|
proc := tprocess.Create(nil);
|
||||||
proc.Executable := 'pgrep';
|
proc.Executable := 'pgrep';
|
||||||
proc.Parameters.Add(ExeName);
|
proc.Parameters.Add(ExeName);
|
||||||
|
@ -930,9 +939,7 @@ begin
|
||||||
lst := TStringList.Create;
|
lst := TStringList.Create;
|
||||||
try
|
try
|
||||||
lst.LoadFromStream(proc.Output);
|
lst.LoadFromStream(proc.Output);
|
||||||
lstText := lst.Text;
|
Result := StrToInt(Trim(lst.Text));
|
||||||
RemoveLeadingChars(lstText, stripChars);
|
|
||||||
Result := StrToInt(lstText);
|
|
||||||
finally
|
finally
|
||||||
lst.Free;
|
lst.Free;
|
||||||
end;
|
end;
|
||||||
|
|
Loading…
Reference in New Issue