debug logs
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit

This commit is contained in:
Scott E. Graves 2025-04-15 13:59:03 -05:00
parent d65bd6af35
commit 757c880616
2 changed files with 13 additions and 2 deletions

View File

@ -28,6 +28,7 @@
#include "drives/directory_iterator.hpp"
#include "drives/remote/remote_open_file_table.hpp"
#include "events/event_system.hpp"
#include "events/types/debug_log.hpp"
#include "events/types/remote_server_event.hpp"
#include "platform/platform.hpp"
#include "types/remote.hpp"
@ -1448,10 +1449,19 @@ auto remote_server::winfsp_rename(PVOID /*file_desc*/, PWSTR file_name,
: 0);
} else {
auto dir{utils::file::directory(file_path)};
event_system::instance().raise<debug_log>(
function_name,
fmt::format("path|{}|exists|{}", file_path, dir.exists()));
if (dir.exists()) {
if (dir.count(false) == 0U) {
auto count{dir.count(false)};
event_system::instance().raise<debug_log>(
function_name, fmt::format("path|{}|count|{}", file_path, count));
if (count == 0U) {
res = drive_.rename_directory(construct_api_path(file_path),
construct_api_path(new_file_path));
event_system::instance().raise<debug_log>(
function_name,
fmt::format("path|{}|res|{}", api_error_to_string(res)));
ret = ((res < 0)
? errno == EISDIR
? static_cast<packet::error_type>(STATUS_ACCESS_DENIED)

View File

@ -74,7 +74,7 @@ TYPED_TEST(winfsp_test, rename_fails_if_dest_exists_and_replace_is_false) {
utils::path::combine(dir_path, {"test_file2_5"}),
};
auto file_path3{
utils::path::combine(dir_path, {"test_file_5"}),
utils::path::combine(dir_path, {"test_file3_5"}),
};
ASSERT_TRUE(::CreateDirectoryA(dir_path.c_str(), nullptr));
@ -157,6 +157,7 @@ TYPED_TEST(winfsp_test, rename_dir_succeeds_if_dest_does_not_exist) {
ASSERT_TRUE(::CreateDirectoryA(dir_path.c_str(), nullptr));
EXPECT_TRUE(::MoveFileExA(dir_path.c_str(), dir_path2.c_str(), 0));
fmt::println("error|{}", ::GetLastError());
EXPECT_TRUE(::RemoveDirectoryA(dir_path2.c_str()));
}