Skip to content

Commit 22635d8

Browse files
hydrogen-mvmpsychonic
authored andcommitted
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.
1 parent fb9b284 commit 22635d8

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

core/logic/smn_filesystem.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,6 +1195,7 @@ REGISTER_NATIVES(filesystem)
11951195
{"File.WriteLine", sm_WriteFileLine},
11961196
{"File.EndOfFile", sm_IsEndOfFile},
11971197
{"File.Seek", sm_FileSeek},
1198+
{"File.Flush", sm_FlushFile},
11981199
{"File.Position.get", sm_FilePosition},
11991200
{"File.ReadInt8", File_ReadTyped<int8_t>},
12001201
{"File.ReadUint8", File_ReadTyped<uint8_t>},

plugins/include/files.inc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,13 @@ methodmap File < Handle
233233
// @return True on success, false otherwise.
234234
public native bool Seek(int position, int where);
235235

236+
// Flushes a file's buffered output; any buffered output
237+
// is immediately written to the file.
238+
//
239+
// @return True on success or use_valve_fs specified with OpenFile,
240+
// otherwise false on failure.
241+
public native bool Flush();
242+
236243
// Get the current position in the file; returns -1 on failure.
237244
property int Position {
238245
public native get();

0 commit comments

Comments
 (0)