ReadDirectory
Reads the next entry from a directory.
Synopsis
int32 ReadDirectory( Directory *dir, DirectoryEntry *de )
Description
This routine reads the next entry from the specified directory. It stores the information from the directory entry into the supplied DirectoryEntry structure. You can then examine the DirectoryEntry structure for information about the entry.
The most interesting fields in the DirectoryEntry structure are:
- de_FileName
- The name of the entry.
-
-
- de_Flags
- This contains a series of bit flags that describe characteristics of the entry. Flags of interest are FILE_IS_DIRECTORY, which indicates the entry is a nested directory and FILE_IS_READONLY, which tells you the file cannot be written to.
- de_Type
- This is currently one of FILE_TYPE_DIRECTORY, FILE_TYPE_LABEL, or FILE_TYPE_CATAPULT.
- de_BlockSize
- This is the size in bytes of the blocks when reading this entry.
- de_ByteCount
- The logical count of the number of useful bytes within the blocks allocated for this file.
- de_BlockCount
- The number of blocks allocated for this file.
You can use OpenDirectoryPath()
and ReadDirectory()
to scan the list of mounted file systems. This is done by supplying a path of "/" to OpenDirectoryPath()
. The entries that ReadDirectory()
returns will correspond to all of the mounted file systems. You can then look at the de_Flags field to determine if a file system is readable or not.
Arguments
- dir
- A pointer to the directory structure for the directory.
- de
- A pointer to a DirectoryEntry structure in which to receive the information about the next directory entry.
Return Value
This function returns zero if successful or a negative error code if an error (such as end-of-directory) occurs.
Implementation
Folio call implemented in file folio V20.
Associated Files
directoryfunctions.h, filesystem.lib
See Also
OpenDirectoryItem
(), OpenDirectoryPath()