From cd686732d71b8047d990c31d70c1db89ddcf3b48 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Sat, 11 Mar 2017 17:17:03 +0100 Subject: [PATCH] compilers paths, add detection of LDC2 and GDC when extracted from rls archive --- src/ce_compilers.lfm | 2 +- src/ce_compilers.pas | 33 +++++++++++++++++++++++++++++++-- src/ce_ddemangle.pas | 2 +- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/src/ce_compilers.lfm b/src/ce_compilers.lfm index c45a1737..f7cf6c49 100644 --- a/src/ce_compilers.lfm +++ b/src/ce_compilers.lfm @@ -6,7 +6,7 @@ object CompilersPathsEditor: TCompilersPathsEditor Caption = 'CompilersPathsEditor' ClientHeight = 869 ClientWidth = 460 - LCLVersion = '1.6.0.4' + LCLVersion = '1.6.4.0' object ScrollBox1: TScrollBox Left = 0 Height = 869 diff --git a/src/ce_compilers.pas b/src/ce_compilers.pas index 677b97a9..5bad817f 100644 --- a/src/ce_compilers.pas +++ b/src/ce_compilers.pas @@ -693,13 +693,42 @@ begin end; procedure TCompilersPathsEditor.autoDetectGDC; +var + path: string; + str: TStringList; begin - //TODO-cCompilerPaths: detect GDC + path := exeFullName('gdc' + exeExt); + if path.fileExists then + begin + fPaths.GdcExeName:= path; + str := TStringList.Create; + try + path := path.extractFileDir.extractFilePath; + FindAllDirectories(str, path, true); + for path in str do + if pos('include' + DirectorySeparator + 'd', path) > 0 then + begin + fPaths.GdcRuntimePath:= path; + break; + end; + finally + str.Free; + end; + end; end; procedure TCompilersPathsEditor.autoDetectLDC; +var + path: string; begin - //TODO-cCompilerPaths: detect LDC + path := exeFullName('ldc2' + exeExt); + if path.fileExists then + begin + fPaths.LdcExeName:= path; + path := path.extractFilePath.extractFilePath + DirectorySeparator + 'import'; + if path.dirExists then + fPaths.LdcRuntimePath:=path; + end; end; {$ENDREGION} diff --git a/src/ce_ddemangle.pas b/src/ce_ddemangle.pas index 79ffa049..2fbc2961 100644 --- a/src/ce_ddemangle.pas +++ b/src/ce_ddemangle.pas @@ -113,7 +113,7 @@ end; function demangle(const value: string): string; begin - if demangler.active and (pos('_D', value) <> -1) then + if demangler.active and (pos('_D', value) > 0) then begin demangler.output.Clear; demangler.demangle(value);