improve ldc library path detection

This commit is contained in:
Basile Burg 2017-07-11 20:41:55 +02:00
parent 0cc827bb2a
commit 323ea7cfdf
No known key found for this signature in database
GPG Key ID: 1868039F415CB8CF
1 changed files with 18 additions and 3 deletions

View File

@ -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}