refactor
This commit is contained in:
parent
924b79add2
commit
8e2ebf05b8
@ -137,14 +137,15 @@ public:
|
|||||||
|
|
||||||
auto populate_file_info(const std::string &api_path,
|
auto populate_file_info(const std::string &api_path,
|
||||||
remote::file_info &file_info) -> api_error override {
|
remote::file_info &file_info) -> api_error override {
|
||||||
const auto file_path = utils::path::combine(mount_location_, {api_path});
|
auto file_path = utils::path::combine(mount_location_, {api_path});
|
||||||
const auto directory = utils::file::directory(file_path).exists();
|
auto directory = utils::file::directory(file_path).exists();
|
||||||
const auto attributes =
|
auto attributes =
|
||||||
FILE_FLAG_BACKUP_SEMANTICS |
|
FILE_FLAG_BACKUP_SEMANTICS |
|
||||||
(directory ? FILE_ATTRIBUTE_DIRECTORY : FILE_ATTRIBUTE_NORMAL);
|
(directory ? FILE_ATTRIBUTE_DIRECTORY : FILE_ATTRIBUTE_NORMAL);
|
||||||
const auto share_mode = FILE_SHARE_READ | FILE_SHARE_WRITE;
|
auto share_mode = FILE_SHARE_READ | FILE_SHARE_WRITE;
|
||||||
auto handle = ::CreateFileA(&file_path[0], GENERIC_READ, share_mode,
|
auto handle =
|
||||||
nullptr, OPEN_EXISTING, attributes, nullptr);
|
::CreateFileA(file_path.c_str(), GENERIC_READ, share_mode, nullptr,
|
||||||
|
OPEN_EXISTING, static_cast<DWORD>(attributes), nullptr);
|
||||||
FILE_BASIC_INFO fi{};
|
FILE_BASIC_INFO fi{};
|
||||||
::GetFileInformationByHandleEx(handle, FileBasicInfo, &fi, sizeof(fi));
|
::GetFileInformationByHandleEx(handle, FileBasicInfo, &fi, sizeof(fi));
|
||||||
if (not directory) {
|
if (not directory) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user