[fpc-pascal] Warning: Symbol "faHidden" is not portable

Giuliano Colla giuliano.colla at fastwebnet.it
Sat Jul 20 20:46:17 CEST 2019


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,

Giuliano

-- 
Do not do to others as you would have them do to you.They might have different tastes.



More information about the fpc-pascal mailing list