This commit is contained in:
Scott E. Graves 2024-09-06 11:24:50 -05:00
parent a7239558bd
commit d12b5f7b05

View File

@ -176,13 +176,13 @@ auto get_times(std::string_view path) -> std::optional<file_times> {
file_times ret{};
#if defined(_WIN32)
auto file_handle =
::CreateFileA(std::string{path}.c_str(), GENERIC_READ,
FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
nullptr, OPEN_EXISTING, 0U, nullptr);
auto file_handle = ::CreateFileA(
std::string{path}.c_str(), GENERIC_READ,
FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr,
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr);
if (file_handle == INVALID_HANDLE_VALUE) {
throw std::runtime_error("failed to get file times|" + std::string{path} +
'|' +
throw std::runtime_error("failed to open file to get file times|" +
std::string{path} + '|' +
std::to_string(utils::get_last_error_code()));
}