[fpc-pascal] Warning: Symbol "faHidden" is not portable
james at productionautomation.net
Sat Jul 20 23:18:29 CEST 2019
I appreciate the explanation it makes sense to me now.
From: fpc-pascal <fpc-pascal-bounces at lists.freepascal.org> On Behalf Of Giuliano Colla
Sent: Saturday, July 20, 2019 2:46 PM
To: fpc-pascal at lists.freepascal.org
Subject: Re: [fpc-pascal] Warning: Symbol "faHidden" is not portable
Il 19/07/2019 19:32, James Richters ha scritto:
> I'm using Windows 10, but I may in the future want to make a Linux version of my program. I guess that's what the warning is about.. that fAHidden won't detect hidden files on some operating systems?
More exactly it means that fAHidden won't detect a hidden file in any OS, except Windows (and DOS if you care about).
It means File Attribute = Hidden, and only Microsoft has the Hidden flag among the file attributes.
A file in Linux is hidden if the first character of its name is a dot.
If you want to make a file hidden, or make visible a hidden file, you must rename it. But this visibility rule applies only to POSIX human interface applications. If you programmatically read a directory, you always get all files.
If your goal is to get all files of a directory, hidden or not, then you need fAHidden only for Windows, because the fpc procedures will get all of them under Linux.
If your goal is to tell apart hidden files from visible ones then you must use platform specific ifdef's, using fAHidden for Windows, and checking for the first character of the name under Linux (or UNIX, because all Unices follow the same rule).
Hope that it helps,
Do not do to others as you would have them do to you.They might have different tastes.
fpc-pascal maillist - fpc-pascal at lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
More information about the fpc-pascal