diff --git a/src/ce_ddemangle.pas b/src/ce_ddemangle.pas index 8c2c3378..1c313a45 100644 --- a/src/ce_ddemangle.pas +++ b/src/ce_ddemangle.pas @@ -6,7 +6,7 @@ interface uses Classes, SysUtils, process, forms, - ce_processes, ce_common; + ce_processes, ce_common, ce_stringrange; type @@ -35,21 +35,50 @@ var demangler: TCEDDemangler; constructor TCEDDemangler.create; +var + s: string = '.0.'; + r: TStringRange; + v: integer; begin fList := TStringList.Create; fOut := TStringList.Create; fProc := TCEProcess.create(nil); - fProc.Executable:= exeFullName('ddemangle' + exeExt); - fProc.Options:= [poUsePipes]; - fProc.OnTerminate:=@procTerminate; - fProc.ShowWindow:= swoHIDE; - fProc.execute; - fActive := true; + + // up to version 2.071 ddemangle cannot be daemon-ized + with TProcess.Create(nil) do + try + Executable := exeFullName('dmd' + exeExt); + 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; destructor TCEDDemangler.destroy; begin - fProc.Terminate(0); + if fProc.Running then + fProc.Terminate(0); fProc.Free; fOut.Free; fList.Free; diff --git a/src/ce_infos.pas b/src/ce_infos.pas index 9b590fc0..c7099d52 100644 --- a/src/ce_infos.pas +++ b/src/ce_infos.pas @@ -43,10 +43,12 @@ type Label1: TLabel; private procedure RefreshAllStatus; + function findCriticalyMissingTool: boolean; protected procedure SetVisible(Value: Boolean); override; public constructor create(aOwner: TComponent); override; + property hasMissingTools: boolean read findCriticalyMissingTool; end; implementation @@ -219,7 +221,7 @@ begin 'optional, the LDC D compiler'); itm.Parent := boxTools; itm.ReAlign; - itm := TToolInfo.Construct(self, tikOptional, 'ddemangle', + itm := TToolInfo.Construct(self, tikFindable, 'ddemangle', 'optional, allows to demangle the symbols in the message widget'); itm.Parent := boxTools; itm.ReAlign; @@ -249,6 +251,23 @@ begin Realign; 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; var i: integer; diff --git a/src/ce_main.pas b/src/ce_main.pas index d44d7d3d..06665e9e 100644 --- a/src/ce_main.pas +++ b/src/ce_main.pas @@ -1794,7 +1794,11 @@ begin setSplitterWheelEvent; if fFirstTimeCoedit then + begin actFileNewRun.Execute; + if fInfoWidg.hasMissingTools then + fInfoWidg.showWidget; + end; if fAppliOpts.autoCheckUpdates then begin