On Wed, 18 Sep 2019, Bart via lazarus wrote:

On Wed, Sep 18, 2019 at 11:26 PM Torsten Bonde Christiansen via
lazarus <[email protected]> wrote:

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;

Not anymore in trunk:

function FileExistsUTF8(const Filename: string): boolean;
begin
 Result := SysUtils.FileExists(Filename);
end;

This will return False for directories.
(The test for (Attr and FILE_ATTRIBUTE_DIRECTORY) = 0 is done by fpc now).

On *nix everything is a file, so folders are reported to be files as well AFAIK.

SysUtils.FileExists also returns false for directories, to match windows
behavour.

Michael.
--
_______________________________________________
lazarus mailing list
[email protected]
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to