diff --git a/repertory/repertory_test/include/mocks/mock_winfsp_drive.hpp b/repertory/repertory_test/include/mocks/mock_winfsp_drive.hpp index 35415cf8..d559d5fa 100644 --- a/repertory/repertory_test/include/mocks/mock_winfsp_drive.hpp +++ b/repertory/repertory_test/include/mocks/mock_winfsp_drive.hpp @@ -137,14 +137,15 @@ public: auto populate_file_info(const std::string &api_path, remote::file_info &file_info) -> api_error override { - const auto file_path = utils::path::combine(mount_location_, {api_path}); - const auto directory = utils::file::directory(file_path).exists(); - const auto attributes = + auto file_path = utils::path::combine(mount_location_, {api_path}); + auto directory = utils::file::directory(file_path).exists(); + auto attributes = FILE_FLAG_BACKUP_SEMANTICS | (directory ? FILE_ATTRIBUTE_DIRECTORY : FILE_ATTRIBUTE_NORMAL); - const auto share_mode = FILE_SHARE_READ | FILE_SHARE_WRITE; - auto handle = ::CreateFileA(&file_path[0], GENERIC_READ, share_mode, - nullptr, OPEN_EXISTING, attributes, nullptr); + auto share_mode = FILE_SHARE_READ | FILE_SHARE_WRITE; + auto handle = + ::CreateFileA(file_path.c_str(), GENERIC_READ, share_mode, nullptr, + OPEN_EXISTING, static_cast(attributes), nullptr); FILE_BASIC_INFO fi{}; ::GetFileInformationByHandleEx(handle, FileBasicInfo, &fi, sizeof(fi)); if (not directory) {