From 323ea7cfdf6b2d91507304008a0a6fba86ff755f Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Tue, 11 Jul 2017 20:41:55 +0200 Subject: [PATCH] improve ldc library path detection --- src/ce_compilers.pas | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/ce_compilers.pas b/src/ce_compilers.pas index 5bad817f..3cc5e13f 100644 --- a/src/ce_compilers.pas +++ b/src/ce_compilers.pas @@ -719,15 +719,30 @@ end; procedure TCompilersPathsEditor.autoDetectLDC; var + i: integer; path: string; + str: TStringList; begin 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; + str := TStringList.Create; + try + path := path.extractFileDir.extractFilePath; + FindAllDirectories(str, path, true); + for path in str do + begin + i := pos('import' + DirectorySeparator + 'ldc', path); + if i > 0 then + begin + fPaths.LdcRuntimePath:= path[1..i + 5]; + break; + end; + end; + finally + str.Free; + end; end; end; {$ENDREGION}