Tao.PhysFs SDK Documentation

Fs.PHYSFS_enumerateFiles Method 

Get a file listing of a search path's directory.

[Visual Basic]
Public Shared Function PHYSFS_enumerateFiles( _
   ByVal dir As String _
) As String()
[C#]
public static string[] PHYSFS_enumerateFiles(
   string dir
);

Parameters

dir
directory in platform-independent notation to enumerate.

Return Value

Null-terminated array of null-terminated strings.

Remarks

Matching directories are interpolated. That is, if "C:\mydir" is in the search path and contains a directory "savegames" that contains "x.sav", "y.sav", and "z.sav", and there is also a "C:\userdir" in the search path that has a "savegames" subdirectory with "w.sav", then the following code:

            char **rc = PHYSFS_enumerateFiles("savegames");
            char **i;
            for (i = rc; *i != NULL; i++)
                    printf(" * We've got [%s].\n", *i);
                    PHYSFS_freeList(rc);
            
...will print:
            * We've got [x.sav].
            * We've got [y.sav].
            * We've got [z.sav].
            * We've got [w.sav].
            

Feel free to sort the list however you like. We only promise there will be no duplicates, but not what order the final list will come back in.

Don't forget to call PHYSFS_freeList with the return value from this function when you are done with it.

Note that Tao.PhysFs calls PHYSFS_freeList for you.

See Also

Fs Class | Tao.PhysFs Namespace