Add support for specifying gameinfo search path when using valveFS in file natives

This commit is contained in:
Nicholas Hastings
2014-08-22 06:00:43 -07:00
parent b95e7ff145
commit 73115f7afa
4 changed files with 107 additions and 41 deletions
+27 -19
View File
@@ -110,11 +110,12 @@ native BuildPath(PathType:type, String:buffer[], maxlength, const String:fmt[],
* @param path Path to open.
* @param use_valve_fs If true, the Valve file system will be used instead.
* This can be used to find files existing in any of
* the GAME search paths, rather than solely files
* the Valve search paths, rather than solely files
* existing directly in the gamedir.
* @param valve_path_id If use_valve_fs, a search path from gameinfo or NULL_STRING for all search paths.
* @return A Handle to the directory, INVALID_HANDLE on open error.
*/
native Handle:OpenDirectory(const String:path[], bool:use_valve_fs=false);
native Handle:OpenDirectory(const String:path[], bool:use_valve_fs=false, const String:valve_path_id[]="GAME");
/**
* Reads the current directory entry as a local filename, then moves to the next file.
@@ -141,24 +142,26 @@ native bool:ReadDirEntry(Handle:dir, String:buffer[], maxlength, &FileType:type=
* @param file File to open.
* @param mode Open mode.
* @param use_valve_fs If true, the Valve file system will be used instead.
* This can be used to find files existing in any of
* the GAME search paths, rather than solely files
* existing directly in the gamedir.
* This can be used to find files existing in valve
* search paths, rather than solely files existing directly
* in the gamedir.
* @param valve_path_id If use_valve_fs, a search path from gameinfo or NULL_STRING for all search paths.
* @return A Handle to the file, INVALID_HANDLE on open error.
*/
native Handle:OpenFile(const String:file[], const String:mode[], bool:use_valve_fs=false);
native Handle:OpenFile(const String:file[], const String:mode[], bool:use_valve_fs=false, const String:valve_path_id[]="GAME");
/**
* Deletes a file.
*
* @param path Path of the file to delete.
* @param use_valve_fs If true, the Valve file system will be used instead.
* This can be used to delete files existing in the game's
* DEFAULT_WRITE_PATH search path, rather than solely files
* existing directly in the gamedir.
* This can be used to delete files existing in the Valve
* search path, rather than solely files existing directly
* in the gamedir.
* @param valve_path_id If use_valve_fs, a search path from gameinfo or NULL_STRING for all search paths.
* @return True on success, false otherwise.
*/
native bool:DeleteFile(const String:path[], bool:use_valve_fs=false);
native bool:DeleteFile(const String:path[], bool:use_valve_fs=false, const String:valve_path_id="DEFAULT_WRITE_PATH");
/**
* Reads a line from a text file.
@@ -316,11 +319,12 @@ native FilePosition(Handle:file);
* @param path Path to the file.
* @param use_valve_fs If true, the Valve file system will be used instead.
* This can be used to find files existing in any of
* the GAME search paths, rather than solely files
* the Valve search paths, rather than solely files
* existing directly in the gamedir.
* @param valve_path_id If use_valve_fs, a search path from gameinfo or NULL_STRING for all search paths.
* @return True if the file exists, false otherwise.
*/
native bool:FileExists(const String:path[], bool:use_valve_fs=false);
native bool:FileExists(const String:path[], bool:use_valve_fs=false, const String:valve_path_id="GAME");
/**
* Renames a file.
@@ -329,10 +333,11 @@ native bool:FileExists(const String:path[], bool:use_valve_fs=false);
* @param oldpath Path to the existing file.
* @param use_valve_fs If true, the Valve file system will be used instead.
* This can be used to rename files in the game's
* DEFAULT_WRITE_PATH search path, rather than directly in the gamedir.
* Valve search paths, rather than directly in the gamedir.
* @param valve_path_id If use_valve_fs, a search path from gameinfo or NULL_STRING for all search paths.
* @return True on success or use_valve_fs specified, false otherwise.
*/
native bool:RenameFile(const String:newpath[], const String:oldpath[], bool:use_valve_fs=false);
native bool:RenameFile(const String:newpath[], const String:oldpath[], bool:use_valve_fs=false, const String:valve_path_id="DEFAULT_WRITE_PATH");
/**
* Checks if a directory exists.
@@ -340,11 +345,12 @@ native bool:RenameFile(const String:newpath[], const String:oldpath[], bool:use_
* @param path Path to the directory.
* @param use_valve_fs If true, the Valve file system will be used instead.
* This can be used to find files existing in any of
* the GAME search paths, rather than solely files
* the Valve search paths, rather than solely files
* existing directly in the gamedir.
* @param valve_path_id If use_valve_fs, a search path from gameinfo or NULL_STRING for all search paths.
* @return True if the directory exists, false otherwise.
*/
native bool:DirExists(const String:path[], bool:use_valve_fs=false);
native bool:DirExists(const String:path[], bool:use_valve_fs=false, const String:valve_path_id="GAME");
/**
* Get the file size in bytes.
@@ -352,11 +358,12 @@ native bool:DirExists(const String:path[], bool:use_valve_fs=false);
* @param path Path to the file.
* @param use_valve_fs If true, the Valve file system will be used instead.
* This can be used to find files existing in any of
* the GAME search paths, rather than solely files
* the Valve search paths, rather than solely files
* existing directly in the gamedir.
* @param valve_path_id If use_valve_fs, a search path from gameinfo or NULL_STRING for all search paths.
* @return File size in bytes, -1 if file not found.
*/
native FileSize(const String:path[], bool:use_valve_fs=false);
native FileSize(const String:path[], bool:use_valve_fs=false, const String:valve_path_id="GAME");
/**
* Flushes a file's buffered output; any buffered output
@@ -395,7 +402,8 @@ native bool:RemoveDir(const String:path[]);
* the execute bit set on Linux. On Windows, the mode is ignored.
* @param use_valve_fs If true, the Valve file system will be used instead.
* This can be used to create folders in the game's
* DEFAULT_WRITE_PATH search path, rather than directly in the gamedir.
* Valve search paths, rather than directly in the gamedir.
* @param valve_path_id If use_valve_fs, a search path from gameinfo or NULL_STRING for default.
* In this case, mode is ignored.
*/
native bool:CreateDirectory(const String:path[], mode, bool:use_valve_fs=false);