plugins/include/files.inc
author David Anderson <dvander@alliedmods.net>
Mon Jan 01 21:46:33 2007 +0000 (2007-01-01)
changeset 257 583a23434070
parent 252 ce166c465bad
child 274 959c85596341
permissions -rw-r--r--
more natives touchups/additions
     1 /**
     2  * :TODO: license info
     3  */
     4 
     5 #if defined _files_included
     6  #endinput
     7 #endif
     8 #define _files_included
     9 
    10 /* @note All paths in SourceMod natives are relative to the mod folder unless otherwise noted. */
    11  
    12 enum FileType
    13 {
    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 */
    17 };
    18 
    19 #define PLATFORM_MAX_PATH		256
    20 
    21 /**
    22  * @brief Opens a directory/folder for contents enumeration.
    23  * @note Directories are closed with CloseHandle().
    24  * @note Directories Handles can be cloned.
    25  *
    26  * @param path			Path to open.
    27  * @return			A Handle to the directory, INVALID_HANDLE on open error.
    28  */
    29 native Handle:OpenDirectory(const String:path[]);
    30 
    31 /**
    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.
    35  * 
    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. 
    42  */
    43 native bool:ReadDirEntry(Handle:dir, String:buffer[], maxlength, &FileType:type=FileType_Unknown);