Name
StatDir -- obtain information about a directory (V9.0)
Synopsis
int ok = StatDir(APTR handle, ULONG flags, struct hwos_StatStruct *st,
                   struct hwTagList *tags);
Function
This function is optional and must only be implemented if the HWEXT_DIRADAPTER_STAT extension bit has been set. See Extension plugins for details. In that case, this function has to do the same as Stat() but instead of a string describing a path to a file system object it has to be able to obtain information about a directory from its handle allocated by OpenDir(). StatDir() needs to write the information about the directory to the structure pointer passed in parameter 3. struct hwos_StatStruct looks like this:

 
struct hwos_StatStruct
{
    int Type;                               // [out]
    DOSINT64 Size;                          // [out]
    ULONG Flags;                            // [out]
    struct hwos_DateStruct Time;            // [out]
    struct hwos_DateStruct LastAccessTime;  // [out]
    struct hwos_DateStruct CreationTime;    // [out]
    STRPTR FullPath;                        // [out]
    STRPTR Comment;                         // [out]
    int LinkMode;                           // [unused]
    STRPTR Container;                       // [unused]
};

Your StatDir() implementation needs to write the following information to the individual structure members:

Type:
This must always be set to HWSTATTYPE_DIRECTORY.

Size:
This must be set to 0.

Flags:
Combination of flags describing the file system object attributes. See File attributes for a list of supported attributes.

Time:
Time stamp indicating when this file system object was last modified. This information is optional. Do not touch this member if you don't have this time information.

LastAccessTime:
Time stamp indicating when this file system object was last accessed. This information is optional. Do not touch this member if you don't have this time information.

CreationTime:
Time stamp indicating when this file system object was created. This information is optional. Do not touch this member if you don't have this time information.

FullPath:
Fully qualified path to the directory. This must be provided. If the HWSTATFLAGS_ALLOCSTRINGS flag is not set, you can set this to a static string buffer which must stay valid until the next call to StatDir(). If HWSTATFLAGS_ALLOCSTRINGS has been set, you need to allocate a string buffer using hw_TrackedAlloc().

Comment:
Comment stored for this directory in the file system. Set this to NULL if you do not have this information or the file system doesn't support storage of comments. If the HWSTATFLAGS_ALLOCSTRINGS flag is not set, you can set this to a static string buffer which must stay valid until the next call to StatDir(). If HWSTATFLAGS_ALLOCSTRINGS has been set, you need to allocate a string buffer using hw_TrackedAlloc().

The following flags are supported by StatDir():

HWSTATFLAGS_ALLOCSTRINGS:
If this flag is set, StatDir() must not use static string buffers for the FullPath and Comment structure members but allocate new private string buffers for them. Hollywood will then call hw_TrackedFree() on these buffers once it is done with them. This flag is often set when StatDir() is used in a multithreaded setup.

StatDir() has to return True on success or False on failure.

This function must be implemented in a thread-safe manner if the HWSTATFLAGS_ALLOCSTRINGS flag is set.

Inputs
handle
directory handle returned by OpenDir()
flags
additional flags (see above)
st
pointer to a struct hwos_StatStruct for storing information about the directory
tags
reserved for future use (currently NULL)
Results
ok
True to indicate success, False on failure

Show TOC