5 #if defined _files_included
8 #define _files_included
10 /* @note All paths in SourceMod natives are relative to the mod folder unless otherwise noted. */
14 FileType_Unknown = 0, /* Unknown file type (device/socket) */
15 FileType_Directory = 1, /* File is a directory */
16 FileType_File = 2, /* File is a file */
19 #define PLATFORM_MAX_PATH 256
22 * @brief Opens a directory/folder for contents enumeration.
23 * @note Directories are closed with CloseHandle().
24 * @note Directories Handles can be cloned.
26 * @param path Path to open.
27 * @return A Handle to the directory, INVALID_HANDLE on open error.
29 native Handle:OpenDirectory(const String:path[]);
32 * @brief Reads the current directory entry as a local filename, then moves to the next file.
33 * @note Contents of buffers are undefined when returning false.
34 * @note Both the '.' and '..' automatic directory entries will be retrieved for Windows and Linux.
36 * @param dir Handle to a directory.
37 * @param buffer String buffer to hold directory name.
38 * @param maxlength Maximum size of string buffer.
39 * @param type Optional variable to store the file type.
40 * @return True on success, false if there are no more files to read.
41 * @error Invalid or corrupt Handle.
43 native bool:ReadDirEntry(Handle:dir, String:buffer[], maxlength, &FileType:type=FileType_Unknown);