MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / windowsStat

Function windowsStat

Libraries/FileSystem/FileSystem.cpp:837–854  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

835}
836
837static SC::Result windowsStat(SC::StringSpan path, bool followLinks, SC::FileSystemStat& fileStat)
838{
839 DWORD flags = FILE_FLAG_BACKUP_SEMANTICS;
840 if (not followLinks)
841 {
842 flags |= FILE_FLAG_OPEN_REPARSE_POINT;
843 }
844
845 HANDLE hFile =
846 ::CreateFileW(path.getNullTerminatedNative(), FILE_READ_ATTRIBUTES,
847 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, nullptr, OPEN_EXISTING, flags, nullptr);
848 if (hFile == INVALID_HANDLE_VALUE)
849 {
850 return SC::Result::Error("stat: Failed to open file");
851 }
852 auto deferClose = SC::MakeDeferred([&]() { CloseHandle(hFile); });
853 return fillWindowsFileStat(hFile, fileStat);
854}
855
856static constexpr SC::uint32_t windowsWriteModeBit = 0200u;
857

Callers 4

chownMethod · 0.85
lchownMethod · 0.85
statMethod · 0.85
lstatMethod · 0.85

Calls 3

MakeDeferredFunction · 0.85
fillWindowsFileStatFunction · 0.85
ErrorEnum · 0.50

Tested by

no test coverage detected