Add File.Flush methodmap (#1056)

This allows us to do FileHandle.Flush() instead of FlushFile(FileHandle) and maintain consistency in always using methodmaps for file I/O operations.
This commit is contained in:
hydrogen-mvm 2019-07-31 18:18:07 -04:00 committed by Nicholas Hastings
parent fb9b284bcf
commit 22635d8d35
2 changed files with 8 additions and 0 deletions

View File

@ -1195,6 +1195,7 @@ REGISTER_NATIVES(filesystem)
{"File.WriteLine", sm_WriteFileLine},
{"File.EndOfFile", sm_IsEndOfFile},
{"File.Seek", sm_FileSeek},
{"File.Flush", sm_FlushFile},
{"File.Position.get", sm_FilePosition},
{"File.ReadInt8", File_ReadTyped<int8_t>},
{"File.ReadUint8", File_ReadTyped<uint8_t>},

View File

@ -233,6 +233,13 @@ methodmap File < Handle
// @return True on success, false otherwise.
public native bool Seek(int position, int where);
// Flushes a file's buffered output; any buffered output
// is immediately written to the file.
//
// @return True on success or use_valve_fs specified with OpenFile,
// otherwise false on failure.
public native bool Flush();
// Get the current position in the file; returns -1 on failure.
property int Position {
public native get();