From acbdbfd2ef765d0095c0d218b1d3dbd2ad32045d Mon Sep 17 00:00:00 2001 From: superp00t Date: Mon, 14 Aug 2023 20:47:09 -0400 Subject: [PATCH] feat(file): add function File::Flush --- bc/file/File.cpp | 14 ++++++++++++++ bc/file/File.hpp | 2 ++ 2 files changed, 16 insertions(+) diff --git a/bc/file/File.cpp b/bc/file/File.cpp index 86f9917..2bbc793 100644 --- a/bc/file/File.cpp +++ b/bc/file/File.cpp @@ -45,6 +45,20 @@ bool Exists(const char* path) { return status; } +bool Flush(StreamRecord* stream) { + auto manager = System_File::Stacked::Manager(); + if (!manager) { + return false; + } + + System_File::Stacked::FileParms parms = {}; + parms.stream = stream; + + auto status = manager->Do(Filesystem::Call::Flush, &parms); + + return status; +} + // Alias of Exists. bool IsFile(const char* path) { return Exists(path); diff --git a/bc/file/File.hpp b/bc/file/File.hpp index da4399e..becffbc 100644 --- a/bc/file/File.hpp +++ b/bc/file/File.hpp @@ -20,6 +20,8 @@ bool Delete(const char* path); bool Exists(const char* path); +bool Flush(StreamRecord* stream); + bool IsFile(const char* path); bool IsDirectory(const char* path);