From e68a4820722c388df88b3d0b2ad8a726f14ef176 Mon Sep 17 00:00:00 2001 From: superp00t Date: Sat, 15 Mar 2025 23:55:16 -0400 Subject: [PATCH] fix(file): add Blizzard::File::Flush --- bc/File.hpp | 1 + bc/file/Flush.cpp | 18 ++++++++++++++++++ bc/file/Flush.hpp | 15 +++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 bc/file/Flush.cpp create mode 100644 bc/file/Flush.hpp diff --git a/bc/File.hpp b/bc/File.hpp index 331bd5b..096c9f9 100644 --- a/bc/File.hpp +++ b/bc/File.hpp @@ -11,6 +11,7 @@ #include "bc/file/CreateDirectory.hpp" #include "bc/file/Delete.hpp" #include "bc/file/Exists.hpp" +#include "bc/file/Flush.hpp" #include "bc/file/GetFileInfo.hpp" #include "bc/file/GetPos.hpp" #include "bc/file/GetWorkingDirectory.hpp" diff --git a/bc/file/Flush.cpp b/bc/file/Flush.cpp new file mode 100644 index 0000000..85b34cc --- /dev/null +++ b/bc/file/Flush.cpp @@ -0,0 +1,18 @@ +#include "bc/file/Flush.cpp" +#include "bc/system/file/Stacked.hpp" + +namespace Blizzard { +namespace File { + +// flush +bool Flush(StreamRecord* file) { + System_File::Stacked::FileParms parms; + parms.op = offsetof(Filesystem, flush); + parms.file = file; + + auto fs = System_File::Stacked::s_manager; + return fs ? fs->flush(fs, &parms) : false; +} + +} // namespace File +} // namespace Blizzard \ No newline at end of file diff --git a/bc/file/Flush.hpp b/bc/file/Flush.hpp new file mode 100644 index 0000000..38c86cc --- /dev/null +++ b/bc/file/Flush.hpp @@ -0,0 +1,15 @@ +#ifndef BC_FILE_FLUSH_HPP +#define BC_FILE_FLUSH_HPP + +#include "bc/file/Types.hpp" + +namespace Blizzard { +namespace File { + +// flush +bool Flush(StreamRecord* file); + +} // namespace File +} // namespace Blizzard + +#endif