diff --git a/support/src/utils/file.cpp b/support/src/utils/file.cpp index e39ccb35..84d8a745 100644 --- a/support/src/utils/file.cpp +++ b/support/src/utils/file.cpp @@ -176,13 +176,13 @@ auto get_times(std::string_view path) -> std::optional { 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())); }