View Issue Details

IDProjectCategoryView StatusLast Update
0037793FPCCompilerpublic2020-09-30 09:03
ReporterLacaK Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
Status newResolutionopen 
Product Version3.0.4 
Summary0037793: Root directory in unit search path (-Fu) is not found
DescriptionWhen in unit search path (-Fu) is specified root directory units in this path are not found and compiler reports "Cannot find XYZ used by ..."
Example: -FuF:\ -Fu\\server\share etc.
Additional InformationUsing RTL SysUtils DirectoryExists('F:\') or DirectoryExists('\\server\share') returns in both cases True.

RTL SysUtils implementation of DirectoryExists() function utilizes (on Windows):

begin
  Attr:=GetFileAttributesW(PWideChar(Directory));
  if Attr <> $ffffffff then
    Result:= (Attr and FILE_ATTRIBUTE_DIRECTORY) > 0
  else
    Result:=False;
end;

May be that compiler uses another check for directory existence (as Tomas mentioned in comment)?
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget-
Attached Files

Activities

Tomas Hajny

2020-09-22 16:43

manager   ~0125757

Quoting from my message in the mailing list:

This looks like the infamous wrong implementation of checking of directory existence based on reading its attributes (which doesn't work for the root directory, because it has no specific entry on the file-system and thus also no attributes, at least on DOS-like systems) without special handling of the special case of the root directory:

cfileutl.pas, line 361-375 (trunk):

    function TCachedDirectory.DirectoryExists(const AName:TCmdStr):boolean;
      var
        Attr : Longint;
      begin
        if not TryUseCache then
          begin
            Result:=PathExists(Name+AName,false);
            exit;
          end;
        Attr:=GetItemAttr(AName);
        if Attr<>0 then
          Result:=((Attr and faDirectory)=faDirectory)
        else
          Result:=false;
      end;

Issue History

Date Modified Username Field Change
2020-09-22 09:24 LacaK New Issue
2020-09-22 16:43 Tomas Hajny Note Added: 0125757
2020-09-30 08:57 LacaK Additional Information Updated View Revisions
2020-09-30 08:57 LacaK FPCTarget => -
2020-09-30 08:58 LacaK Additional Information Updated View Revisions
2020-09-30 09:02 LacaK Additional Information Updated View Revisions
2020-09-30 09:03 LacaK Additional Information Updated View Revisions