[Lazarus] FileExistsUTF8() difference between Unix/Windows

Torsten Bonde Christiansen tc at epidata.info
Wed Sep 18 23:26:49 CEST 2019


On 18/09/2019 23.23, Bart via lazarus wrote:
> On Wed, Sep 18, 2019 at 9:01 PM Torsten Bonde Christiansen via lazarus
> <lazarus at lists.lazarus-ide.org> wrote:
>
>> Is it a bug that FileExistsUTF8(...) reports true/false differently for
>> folders in Unix and Windows.
> Thet are just wrappers for fpc's FileExists() nowadays.
>
>
No entirely though. The Unix version is mostly a wrapper, yes - but the 
Windows version do some additional filtering:

function FileExistsUTF8(const Filename: string): boolean;
var
   Attr: Longint;
begin
   Attr := FileGetAttrUTF8(FileName);
   if Attr <> -1 then
     Result:= (Attr and FILE_ATTRIBUTE_DIRECTORY) = 0
   else
     Result:=False;
end;

Hence my question....

-Torsten.




More information about the lazarus mailing list