[fpc-pascal] -Fu unit search path and network paths

Tomas Hajny XHajT03 at hajny.biz
Mon Sep 21 17:59:10 CEST 2020


On 2020-09-21 14:44, Marco van de Voort via fpc-pascal wrote:
> Op 2020-09-21 om 13:44 schreef LacaK via fpc-pascal:
>> 
>>>>> are supported in -Fu (unit search path) networks paths? i.e. 
>>>>> -Fu\\server\share -Fu\\server\share\path ?
>>>> Correction: unit cannot be found only if it is placed in "share 
>>>> root" \\server\share !
>>>> When is placed in \\server\share\path then it is found.
>>>> 
>>>> Why?
>>> 
>>> Possibly Share vs directory.   A directory has 4 slashes 
>>> (\\x\y\<something), a share two.
>>> 
>>> Try \\server\share\.
>> *Does not works. More confusing is that, when I map \\server\share to 
>> F:\ and I add F:\ to search path it does not work also!
>> *
>> 
>> *(if unit is in any subdirectory i.e. F:\something then it works ... 
>> so only root does not work!)*
>> 
>> *
>> *
>> 
> [0.015] Handling option "-Fud:\"
> [0.015] interpreting option "-Fud:\"
> [0.015] Path "D:\" not found
> 
> So the path exist function probably fails on root dirs.

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;

I suggest filing a bug report.

Tomas


More information about the fpc-pascal mailing list