diff --git a/core/logic/smn_filesystem.cpp b/core/logic/smn_filesystem.cpp index 0e9bd09c..032f951e 100644 --- a/core/logic/smn_filesystem.cpp +++ b/core/logic/smn_filesystem.cpp @@ -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}, {"File.ReadUint8", File_ReadTyped}, diff --git a/plugins/include/files.inc b/plugins/include/files.inc index 826fefd7..bcc256c2 100644 --- a/plugins/include/files.inc +++ b/plugins/include/files.inc @@ -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();