From 0650790c434a653dc008e15e171754c491d43e3e Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Sat, 26 Oct 2024 21:27:35 -0500 Subject: [PATCH] fixes --- .../src/drives/winfsp/winfsp_drive.cpp | 38 +++++++++---------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp b/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp index c9021833..af7ec2d1 100644 --- a/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp +++ b/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp @@ -733,29 +733,25 @@ auto winfsp_drive::Overwrite(PVOID /*file_node*/, PVOID file_desc, api_meta_map meta{}; error = provider_.get_item_meta(api_path, meta); if (error == api_error::success) { - error = api_error::file_in_use; - if (not fm_->is_processing(api_path)) { - error = file->resize(0U); + error = file->resize(0U); + if (error == api_error::success) { + filesystem_item existing_fsi{}; + error = provider_.get_filesystem_item(api_path, false, existing_fsi); if (error == api_error::success) { - filesystem_item existing_fsi{}; - error = - provider_.get_filesystem_item(api_path, false, existing_fsi); - if (error == api_error::success) { - // Handle replace attributes - if (replace_attributes != 0U) { - if (attributes == 0U) { - attributes = FILE_ATTRIBUTE_ARCHIVE; - } - meta[META_ATTRIBUTES] = std::to_string(attributes); + // Handle replace attributes + if (replace_attributes != 0U) { + if (attributes == 0U || attributes == FILE_ATTRIBUTE_NORMAL) { + attributes = FILE_ATTRIBUTE_ARCHIVE; + } + meta[META_ATTRIBUTES] = std::to_string(attributes); + error = provider_.set_item_meta(api_path, meta); + } else if (attributes != 0U) { // Handle merge attributes + const auto current_attributes = + utils::get_attributes_from_meta(meta); + const auto merged_attributes = attributes | current_attributes; + if (merged_attributes != current_attributes) { + meta[META_ATTRIBUTES] = std::to_string(merged_attributes); error = provider_.set_item_meta(api_path, meta); - } else if (attributes != 0U) { // Handle merge attributes - const auto current_attributes = - utils::get_attributes_from_meta(meta); - const auto merged_attributes = attributes | current_attributes; - if (merged_attributes != current_attributes) { - meta[META_ATTRIBUTES] = std::to_string(merged_attributes); - error = provider_.set_item_meta(api_path, meta); - } } } }