Converter: Don't scan the system root directory for pascal sources. Issue #22630, patch from Bart Broersma

git-svn-id: trunk@38276 -
This commit is contained in:
juha 2012-08-19 19:40:57 +00:00
parent 5404ba516d
commit 3ab146851e

View File

@ -398,8 +398,23 @@ end;
procedure TCacheUnitsThread.Execute;
// This assumes that cache is not used while updating it.
// The main GUI thread must wait for this thread before starting conversion.
function IsRootPath(APath: String): Boolean;
//crude function, it maybe needs support for UNC drives
begin
{$ifdef windows}
Result := ((Length(APath) = 3) and (APath[1] in ['a'..'z','A'..'Z']) and (APath[2] = ':') and (APath[3] = PathDelim))
or (APath = PathDelim);
{$else}
Result := (APath = PathDelim);
{$endif}
end;
begin
fConverter.CacheUnitsInPath(fPath); // Scan for unit files.
//If a project is in a subfolder of the root, fPath will be root path.
//Do not search the entire drive, or we may find Borland VCL files and convert them too
if not IsRootPath(fPath) then
fConverter.CacheUnitsInPath(fPath); // Scan for unit files.
end;
{ TConvertDelphiUnit }