[Lazarus] FileExistsUTF8() difference between Unix/Windows
Mattias Gaertner
nc-gaertnma at netcologne.de
Fri Sep 20 20:56:31 CEST 2019
On Thu, 19 Sep 2019 00:02:19 +0200 (CEST)
Michael Van Canneyt via lazarus <lazarus at lists.lazarus-ide.org> wrote:
> On Wed, 18 Sep 2019, Bart via lazarus wrote:
>
> > On Wed, Sep 18, 2019 at 11:26 PM Torsten Bonde Christiansen via
> > lazarus <lazarus at lists.lazarus-ide.org> 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.
I added an incompatibility note:
https://wiki.lazarus.freepascal.org/Lazarus_2.2.0_release_notes#LazUtils_Changes
Mattias
More information about the lazarus
mailing list