aboutsummaryrefslogtreecommitdiff
path: root/zencore
diff options
context:
space:
mode:
authorPer Larsson <[email protected]>2021-10-02 16:32:02 +0200
committerPer Larsson <[email protected]>2021-10-02 16:32:02 +0200
commit8b3f1f2b2bae13925de1f051622115c0e58a68ba (patch)
tree44f22755d1e2f6b79c05201e201d5f2ba26e9f32 /zencore
parentAdded support for choosing best ZEN upstream endpoint based on latency. (diff)
parentzen: added print/printpackage subcommands to help in debugging or inspecting ... (diff)
downloadzen-8b3f1f2b2bae13925de1f051622115c0e58a68ba.tar.xz
zen-8b3f1f2b2bae13925de1f051622115c0e58a68ba.zip
Merge branch 'main' of https://github.com/EpicGames/zen
Diffstat (limited to 'zencore')
-rw-r--r--zencore/filesystem.cpp17
-rw-r--r--zencore/include/zencore/filesystem.h5
2 files changed, 21 insertions, 1 deletions
diff --git a/zencore/filesystem.cpp b/zencore/filesystem.cpp
index 1d6b2f61c..f6ba92f98 100644
--- a/zencore/filesystem.cpp
+++ b/zencore/filesystem.cpp
@@ -522,6 +522,23 @@ WriteFile(std::filesystem::path Path, IoBuffer Data)
WriteFile(Path, &DataPtr, 1);
}
+IoBuffer
+FileContents::Flatten()
+{
+ if (Data.size() == 1)
+ {
+ return Data[0];
+ }
+ else if (Data.empty())
+ {
+ return {};
+ }
+ else
+ {
+ ZEN_NOT_IMPLEMENTED();
+ }
+}
+
FileContents
ReadFile(std::filesystem::path Path)
{
diff --git a/zencore/include/zencore/filesystem.h b/zencore/include/zencore/filesystem.h
index 6678528f6..c7ac7140d 100644
--- a/zencore/include/zencore/filesystem.h
+++ b/zencore/include/zencore/filesystem.h
@@ -2,9 +2,10 @@
#pragma once
-#include "stream.h"
#include "zencore.h"
+#include <zencore/iobuffer.h>
+
#include <filesystem>
#include <functional>
@@ -36,6 +37,8 @@ struct FileContents
{
std::vector<IoBuffer> Data;
std::error_code ErrorCode;
+
+ IoBuffer Flatten();
};
ZENCORE_API FileContents ReadFile(std::filesystem::path Path);