Post by Arnaud NicoletThat's true, but not complete.
Under Mac OS X, files whose name starts with "." are invisibles,
beside the fact that the .visible property is still true. You
should check for the name, if it starts with ".", it's also invisible.
Also, still under Mac OS X, there can be a file named ".hidden" in
the current folder. If it exists, it contains name of files that
are also invisibles, even if the name does not start with "." and
the .visible property is true. You should read the file as text to
discover these invisibles files (I'm not sure what is the purpose
of this ".hidden" file nor who can modify it).
Here is a global method, because of the "extends" option, which is
used to verify that a file is visible or not and it is incorporating
the items that Arnaud mentions above. It returns true if file IS
visible and false if the file IS NOT visible. Note that at some point
in time it seems that OS X quit using the ".hidden" files to name
files that are to be invisible within the parent folder. At least I
have never been able to find one in more recent versions of OS X.
However, I leave the code in this routine in case it is used in an
older OS X version.
Function isVisible(Extends f As FolderItem) As Boolean
// This method, gotten from one of the RB mailing lists, returns
// True if the folderitem passed to it is a visible file and False
// if it is not. It checks for first character being a decimal
// point, if the filename exists in the .hidden file, and if the
// visible bit of the folderitem is true or not.
#if TargetCarbon
Dim sysx As Integer
Dim fp As FolderItem
Dim ts As TextInputStream
Dim hideFiles As String
#endif
if f.Visible Then
#if TargetCarbon
if System.Gestalt("sysv",sysx) and sysx > &h1000 then
if Left(f.name,1) = "." then return false
fp = f.parent
if fp = nil then Return True
fp = fp.child(".hidden")
if fp <> nil and fp.exists and fp.IsReadable then
ts = fp.OpenAsTextFile
hideFiles = chr(10) + ts.ReadAll + chr(10)
if InStr(hideFiles,chr(10) + f.Name + chr(10)) > 0 then
Return False
end if
end if
#endif
return true
end if
#if debugBuild then
#else
exception err
errorAnnouncer err,"isVisible method of the globalStuff module"
#endif
End Function
=== A Mac addict in Tennessee ===