1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/plugins/include/files.inc Mon Jan 01 19:50:16 2007 +0000
1.3 @@ -0,0 +1,42 @@
1.4 +/**
1.5 + * :TODO: license info
1.6 + */
1.7 +
1.8 +#if defined _files_included
1.9 + #endinput
1.10 +#endif
1.11 +#define _files_included
1.12 +
1.13 +/* @note All paths in SourceMod natives are relative to the mod folder unless otherwise noted. */
1.14 +
1.15 +enum FileType
1.16 +{
1.17 + FileType_Unknown = 0, /* Unknown file type (device/socket) */
1.18 + FileType_Directory = 1, /* File is a directory */
1.19 + FileType_File = 2, /* File is a file */
1.20 +};
1.21 +
1.22 +
1.23 +/**
1.24 + * @brief Opens a directory/folder for contents enumeration.
1.25 + * @note Directories are closed with CloseHandle().
1.26 + * @note Directories Handles can be cloned.
1.27 + *
1.28 + * @param path Path to open.
1.29 + * @return A Handle to the directory, INVALID_HANDLE on open error.
1.30 + */
1.31 +native Handle:OpenDirectory(const String:path[]);
1.32 +
1.33 +/**
1.34 + * @brief Reads the current directory entry as a local filename, then moves to the next file.
1.35 + * @note Contents of buffers are undefined when returning false.
1.36 + * @note Both the '.' and '..' automatic directory entries will be retrieved for Windows and Linux.
1.37 + *
1.38 + * @param dir Handle to a directory.
1.39 + * @param buffer String buffer to hold directory name.
1.40 + * @param maxlength Maximum size of string buffer.
1.41 + * @param type Optional variable to store the file type.
1.42 + * @return True on success, false if there are no more files to read.
1.43 + * @error Invalid or corrupt Handle.
1.44 + */
1.45 +native bool:ReadDirEntry(Handle:dir, String:buffer[], maxlength, &FileType:type=0);