diff options
| author | Dan Engelbrecht <[email protected]> | 2024-12-05 14:21:12 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-12-05 14:21:12 +0100 |
| commit | d1c9573ef4b54e03b66a9507a57104591078d35b (patch) | |
| tree | 38dbcbe99a5b76d322d1634014bc390e75b01c20 /src/zencore/filesystem.cpp | |
| parent | Unity build fixes (#253) (diff) | |
| download | zen-d1c9573ef4b54e03b66a9507a57104591078d35b.tar.xz zen-d1c9573ef4b54e03b66a9507a57104591078d35b.zip | |
projectstore getchunks rpc with modtag (#244)
Feature: Project store "getchunks" rpc call /prj/{project}/oplog/{log}/rpc extended to accept both CAS (RawHash) and Id (Oid) identifiers as well as partial ranges
Diffstat (limited to 'src/zencore/filesystem.cpp')
| -rw-r--r-- | src/zencore/filesystem.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/zencore/filesystem.cpp b/src/zencore/filesystem.cpp index 36147c5a9..52f2c4adc 100644 --- a/src/zencore/filesystem.cpp +++ b/src/zencore/filesystem.cpp @@ -1435,12 +1435,34 @@ FileSizeFromHandle(void* NativeHandle) int Fd = int(intptr_t(NativeHandle)); struct stat Stat; fstat(Fd, &Stat); - FileSize = size_t(Stat.st_size); + FileSize = size_t(Stat.st_size); #endif return FileSize; } +uint64_t +GetModificationTickFromHandle(void* NativeHandle, std::error_code& Ec) +{ +#if ZEN_PLATFORM_WINDOWS + FILETIME LastWriteTime; + BOOL OK = GetFileTime((HANDLE)NativeHandle, NULL, NULL, &LastWriteTime); + if (OK) + { + return ((uint64_t(LastWriteTime.dwHighDateTime) << 32) | LastWriteTime.dwLowDateTime); + } +#elif ZEN_PLATFORM_LINUX || ZEN_PLATFORM_MAC + int Fd = int(uintptr_t(NativeHandle)); + struct stat Stat; + if (0 == fstat(Fd, &Stat)) + { + return gsl::narrow<uint64_t>(Stat.st_mtime); + } +#endif + Ec = MakeErrorCodeFromLastError(); + return 0; +} + std::filesystem::path GetRunningExecutablePath() { |