aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/include
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2026-04-21 17:22:18 +0200
committerGitHub Enterprise <[email protected]>2026-04-21 17:22:18 +0200
commit82e222bf23dee04e6fb825037fbb4d86a9571ce0 (patch)
tree007b805500a5e23167ae8acc977efc3a6298d826 /src/zencore/include
parentimproved s3 hydration (#997) (diff)
downloadarchived-zen-82e222bf23dee04e6fb825037fbb4d86a9571ce0.tar.xz
archived-zen-82e222bf23dee04e6fb825037fbb4d86a9571ce0.zip
filesystem.h surface error codes (#998)
- Improvement: File copy, scan, clone, and move operations now report the underlying OS error in failure messages
Diffstat (limited to 'src/zencore/include')
-rw-r--r--src/zencore/include/zencore/filesystem.h42
1 files changed, 19 insertions, 23 deletions
diff --git a/src/zencore/include/zencore/filesystem.h b/src/zencore/include/zencore/filesystem.h
index 6bccb551c..bce902500 100644
--- a/src/zencore/include/zencore/filesystem.h
+++ b/src/zencore/include/zencore/filesystem.h
@@ -121,10 +121,10 @@ uint64_t GetModificationTickFromPath(const std::filesystem::path& Filename);
*/
uint64_t GetModificationTickFromHandle(void* NativeHandle, std::error_code& Ec);
-bool TryGetFileProperties(const std::filesystem::path& Path,
- uint64_t& OutSize,
- uint64_t& OutModificationTick,
- uint32_t& OutNativeModeOrAttributes);
+std::error_code TryGetFileProperties(const std::filesystem::path& Path,
+ uint64_t& OutSize,
+ uint64_t& OutModificationTick,
+ uint32_t& OutNativeModeOrAttributes);
/** Move/rename a file, if the files are not on the same drive the function will fail (throws)
*/
@@ -148,7 +148,7 @@ std::filesystem::path GetRunningExecutablePath();
*/
void MaximizeOpenFileCount();
-bool PrepareFileForScatteredWrite(void* FileHandle, uint64_t FinalSize);
+std::error_code PrepareFileForScatteredWrite(void* FileHandle, uint64_t FinalSize);
struct FileContents
{
@@ -175,16 +175,16 @@ FileContents ReadStdIn();
*/
FileContents ReadFile(const std::filesystem::path& Path);
-bool ScanFile(std::filesystem::path Path, uint64_t ChunkSize, std::function<void(const void* Data, size_t Size)>&& ProcessFunc);
-void WriteFile(std::filesystem::path Path, const IoBuffer* const* Data, size_t BufferCount);
-void WriteFile(std::filesystem::path Path, IoBuffer Data);
-void WriteFile(std::filesystem::path Path, CompositeBuffer Data);
-bool MoveToFile(std::filesystem::path Path, IoBuffer Data);
-void ScanFile(void* NativeHandle,
- uint64_t Offset,
- uint64_t Size,
- uint64_t ChunkSize,
- std::function<void(const void* Data, size_t Size)>&& ProcessFunc);
+std::error_code ScanFile(std::filesystem::path Path, uint64_t ChunkSize, std::function<void(const void* Data, size_t Size)>&& ProcessFunc);
+void WriteFile(std::filesystem::path Path, const IoBuffer* const* Data, size_t BufferCount);
+void WriteFile(std::filesystem::path Path, IoBuffer Data);
+void WriteFile(std::filesystem::path Path, CompositeBuffer Data);
+std::error_code MoveToFile(std::filesystem::path Path, IoBuffer Data);
+void ScanFile(void* NativeHandle,
+ uint64_t Offset,
+ uint64_t Size,
+ uint64_t ChunkSize,
+ std::function<void(const void* Data, size_t Size)>&& ProcessFunc);
void WriteFile(void* NativeHandle, const void* Data, uint64_t Size, uint64_t FileOffset, uint64_t ChunkSize, std::error_code& Ec);
void ReadFile(void* NativeHandle, void* Data, uint64_t Size, uint64_t FileOffset, uint64_t ChunkSize, std::error_code& Ec);
@@ -217,7 +217,7 @@ public:
std::unique_ptr<CloneQueryInterface> GetCloneQueryInterface(const std::filesystem::path& TargetDirectory);
-bool TryCloneFile(const std::filesystem::path& FromPath, const std::filesystem::path& ToPath);
+std::error_code TryCloneFile(const std::filesystem::path& FromPath, const std::filesystem::path& ToPath);
struct CopyFileOptions
{
@@ -225,13 +225,9 @@ struct CopyFileOptions
bool MustClone = false;
};
-bool CopyFile(const std::filesystem::path& FromPath, const std::filesystem::path& ToPath, const CopyFileOptions& Options);
-void CopyFile(const std::filesystem::path& FromPath,
- const std::filesystem::path& ToPath,
- const CopyFileOptions& Options,
- std::error_code& OutError);
-void CopyTree(std::filesystem::path FromPath, std::filesystem::path ToPath, const CopyFileOptions& Options);
-bool SupportsBlockRefCounting(std::filesystem::path Path);
+std::error_code CopyFile(const std::filesystem::path& FromPath, const std::filesystem::path& ToPath, const CopyFileOptions& Options);
+void CopyTree(std::filesystem::path FromPath, std::filesystem::path ToPath, const CopyFileOptions& Options);
+bool SupportsBlockRefCounting(std::filesystem::path Path);
void PathToUtf8(const std::filesystem::path& Path, StringBuilderBase& Out);
std::string PathToUtf8(const std::filesystem::path& Path);