Skip to content
Permalink
Browse files

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.
  • Loading branch information...
hydrogen-mvm authored and psychonic committed Jul 31, 2019
1 parent fb9b284 commit 22635d8d354f42d8e295617d74ea95d3ef28c68b
Showing with 8 additions and 0 deletions.
  1. +1 −0 core/logic/smn_filesystem.cpp
  2. +7 −0 plugins/include/files.inc
@@ -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>},
@@ -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();

0 comments on commit 22635d8

Please sign in to comment.
You can’t perform that action at this time.