mirror of https://gitlab.com/basile.b/dexed.git
fix #118, IDE crash when ddemangle is absent or older than v2.072
This commit is contained in:
parent
c71b291558
commit
922dbda7fb
|
@ -6,7 +6,7 @@ interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, process, forms,
|
Classes, SysUtils, process, forms,
|
||||||
ce_processes, ce_common;
|
ce_processes, ce_common, ce_stringrange;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
@ -35,21 +35,50 @@ var
|
||||||
demangler: TCEDDemangler;
|
demangler: TCEDDemangler;
|
||||||
|
|
||||||
constructor TCEDDemangler.create;
|
constructor TCEDDemangler.create;
|
||||||
|
var
|
||||||
|
s: string = '.0.';
|
||||||
|
r: TStringRange;
|
||||||
|
v: integer;
|
||||||
begin
|
begin
|
||||||
fList := TStringList.Create;
|
fList := TStringList.Create;
|
||||||
fOut := TStringList.Create;
|
fOut := TStringList.Create;
|
||||||
fProc := TCEProcess.create(nil);
|
fProc := TCEProcess.create(nil);
|
||||||
fProc.Executable:= exeFullName('ddemangle' + exeExt);
|
|
||||||
fProc.Options:= [poUsePipes];
|
// up to version 2.071 ddemangle cannot be daemon-ized
|
||||||
fProc.OnTerminate:=@procTerminate;
|
with TProcess.Create(nil) do
|
||||||
fProc.ShowWindow:= swoHIDE;
|
try
|
||||||
fProc.execute;
|
Executable := exeFullName('dmd' + exeExt);
|
||||||
fActive := true;
|
if Executable.fileExists then
|
||||||
|
begin
|
||||||
|
setLength(s, 128);
|
||||||
|
Parameters.Text:= '--version';
|
||||||
|
Options:= [poUsePipes];
|
||||||
|
ShowWindow:= swoHIDE;
|
||||||
|
execute;
|
||||||
|
output.Read(s[1], 128);
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
free;
|
||||||
|
end;
|
||||||
|
r := r.create(s);
|
||||||
|
v := r.popUntil('.')^.popFront^.takeUntil('.').yield.toInt;
|
||||||
|
|
||||||
|
fProc.Executable := exeFullName('ddemangle' + exeExt);
|
||||||
|
if (v >= 72) and fProc.Executable.fileExists then
|
||||||
|
begin
|
||||||
|
fProc.Options:= [poUsePipes];
|
||||||
|
fProc.OnTerminate:=@procTerminate;
|
||||||
|
fProc.ShowWindow:= swoHIDE;
|
||||||
|
fProc.execute;
|
||||||
|
fActive := true;
|
||||||
|
end
|
||||||
|
else fActive := false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TCEDDemangler.destroy;
|
destructor TCEDDemangler.destroy;
|
||||||
begin
|
begin
|
||||||
fProc.Terminate(0);
|
if fProc.Running then
|
||||||
|
fProc.Terminate(0);
|
||||||
fProc.Free;
|
fProc.Free;
|
||||||
fOut.Free;
|
fOut.Free;
|
||||||
fList.Free;
|
fList.Free;
|
||||||
|
|
|
@ -43,10 +43,12 @@ type
|
||||||
Label1: TLabel;
|
Label1: TLabel;
|
||||||
private
|
private
|
||||||
procedure RefreshAllStatus;
|
procedure RefreshAllStatus;
|
||||||
|
function findCriticalyMissingTool: boolean;
|
||||||
protected
|
protected
|
||||||
procedure SetVisible(Value: Boolean); override;
|
procedure SetVisible(Value: Boolean); override;
|
||||||
public
|
public
|
||||||
constructor create(aOwner: TComponent); override;
|
constructor create(aOwner: TComponent); override;
|
||||||
|
property hasMissingTools: boolean read findCriticalyMissingTool;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
@ -219,7 +221,7 @@ begin
|
||||||
'optional, the LDC D compiler');
|
'optional, the LDC D compiler');
|
||||||
itm.Parent := boxTools;
|
itm.Parent := boxTools;
|
||||||
itm.ReAlign;
|
itm.ReAlign;
|
||||||
itm := TToolInfo.Construct(self, tikOptional, 'ddemangle',
|
itm := TToolInfo.Construct(self, tikFindable, 'ddemangle',
|
||||||
'optional, allows to demangle the symbols in the message widget');
|
'optional, allows to demangle the symbols in the message widget');
|
||||||
itm.Parent := boxTools;
|
itm.Parent := boxTools;
|
||||||
itm.ReAlign;
|
itm.ReAlign;
|
||||||
|
@ -249,6 +251,23 @@ begin
|
||||||
Realign;
|
Realign;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCEInfoWidget.findCriticalyMissingTool: boolean;
|
||||||
|
var
|
||||||
|
i: integer;
|
||||||
|
t: TToolInfo;
|
||||||
|
begin
|
||||||
|
result := false;
|
||||||
|
for i := 0 to boxTools.ControlCount -1 do
|
||||||
|
begin
|
||||||
|
if not (boxTools.Controls[i] is TToolInfo) then
|
||||||
|
continue;
|
||||||
|
t := TToolInfo(boxTools.Controls[i]);
|
||||||
|
t.refreshStatus;
|
||||||
|
if (t.fKind in [tikFindable, tikRunning]) and not t.present then
|
||||||
|
result := true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCEInfoWidget.RefreshAllStatus;
|
procedure TCEInfoWidget.RefreshAllStatus;
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
|
|
|
@ -1794,7 +1794,11 @@ begin
|
||||||
setSplitterWheelEvent;
|
setSplitterWheelEvent;
|
||||||
|
|
||||||
if fFirstTimeCoedit then
|
if fFirstTimeCoedit then
|
||||||
|
begin
|
||||||
actFileNewRun.Execute;
|
actFileNewRun.Execute;
|
||||||
|
if fInfoWidg.hasMissingTools then
|
||||||
|
fInfoWidg.showWidget;
|
||||||
|
end;
|
||||||
|
|
||||||
if fAppliOpts.autoCheckUpdates then
|
if fAppliOpts.autoCheckUpdates then
|
||||||
begin
|
begin
|
||||||
|
|
Loading…
Reference in New Issue