From 6eae75d3115095d0519885229773f5ba0e3324cd Mon Sep 17 00:00:00 2001 From: ArceDanielShok Date: Fri, 21 Feb 2025 10:13:44 -0300 Subject: [PATCH] Remove unnecessary debug print statements from PlaceHolderInfo and Wrappers --- .../PlaceHolderInfo.cpp | 1 - .../placeholders_interface/Planceholders.cpp | 39 +------------------ native-src/virtual_drive/Wrappers.cpp | 3 -- 3 files changed, 2 insertions(+), 41 deletions(-) diff --git a/native-src/placeholders_interface/PlaceHolderInfo.cpp b/native-src/placeholders_interface/PlaceHolderInfo.cpp index bd726ab5..2c77c2b7 100644 --- a/native-src/placeholders_interface/PlaceHolderInfo.cpp +++ b/native-src/placeholders_interface/PlaceHolderInfo.cpp @@ -167,7 +167,6 @@ FileHandle handleForPath(const std::wstring &wPath) std::wstring_convert> converter; std::string path = converter.to_bytes(wPath); - printf("path IN HANDLERCREATOR: %s\n", path.c_str()); LPCSTR pPath = path.c_str(); std::filesystem::path pathFs(path); diff --git a/native-src/placeholders_interface/Planceholders.cpp b/native-src/placeholders_interface/Planceholders.cpp index 415401fd..1fbee5e8 100644 --- a/native-src/placeholders_interface/Planceholders.cpp +++ b/native-src/placeholders_interface/Planceholders.cpp @@ -45,9 +45,6 @@ void Placeholders::CreateOne( wstring fullPath = std::wstring(destPath) + L'\\' + fileName; - wprintf(L"[CreatePlaceholder] Full path: %s", fullPath.c_str()); - wprintf(L"\n"); - if (std::filesystem::exists(fullPath)) { Placeholders::ConvertToPlaceholder(fullPath, fileIdentity); @@ -85,7 +82,6 @@ void Placeholders::CreateOne( prop.Value(L"Value1"); prop.IconResource(L"shell32.dll,-44"); - wprintf(L"[CreatePlaceholder] Successfully created placeholder file\n"); // UpdateSyncStatus(fullDestPath, true, false); } catch (...) @@ -112,7 +108,6 @@ void Placeholders::MaintainIdentity(std::wstring &fullPath, PCWSTR itemIdentity, std::string identity = Placeholders::GetFileIdentity(fullPath); if (!identity.empty()) { - wprintf(L"[MaintainIdentity] Identity is not empty\n"); int len = WideCharToMultiByte(CP_UTF8, 0, itemIdentity, -1, NULL, 0, NULL, NULL); if (len > 0) { @@ -120,13 +115,7 @@ void Placeholders::MaintainIdentity(std::wstring &fullPath, PCWSTR itemIdentity, WideCharToMultiByte(CP_UTF8, 0, itemIdentity, -1, &itemIdentityStr[0], len, NULL, NULL); std::string cleanIdentity = cleanString(identity); std::string cleanItemIdentity = cleanString(itemIdentityStr); - printf("[MaintainIdentity] cleanCurrentIdentity: %s\n", cleanIdentity.c_str()); - printf("[MaintainIdentity] cleanItemIdentity: %s\n", cleanItemIdentity.c_str()); - if (cleanIdentity == cleanItemIdentity) - { - wprintf(L"[MaintainIdentity] Identity is corret not need to update\n"); - } - else + if (cleanIdentity != cleanItemIdentity) { wprintf(L"[MaintainIdentity] Identity is incorrect, updating...\n"); std::wstring itemIdentityStrW(itemIdentity); @@ -138,7 +127,6 @@ void Placeholders::MaintainIdentity(std::wstring &fullPath, PCWSTR itemIdentity, // Handle error as needed } } - printf("[MaintainIdentity] End Maintain Identity\n"); } void Placeholders::CreateEntry( @@ -185,17 +173,11 @@ void Placeholders::CreateEntry( wprintf(L"[CreatePlaceholder] Failed to create placeholder directory with HRESULT 0x%08x\n", hr); throw winrt::hresult_error(hr); } - else - { - wprintf(L"[CreatePlaceholder] Successfully created placeholder directory\n"); - } std::wstring finalPath = std::wstring(destPath) + L"\\" + std::wstring(itemName); Placeholders::UpdatePinState(finalPath, PinState::OnlineOnly); UpdateSyncStatus(finalPath, true, true); } - - wprintf(L"[CreatePlaceholder] Successfully created %s at %s\n", isDirectory ? L"directory" : L"file", fullDestPath.c_str()); } catch (const winrt::hresult_error &error) { @@ -230,7 +212,6 @@ bool Placeholders::ConvertToPlaceholder(const std::wstring &fullPath, const std: if (fileHandle == INVALID_HANDLE_VALUE) { // Manejar el error al abrir el archivo - wprintf(L"[ConvertToPlaceholder] Error opening file: %d\n", GetLastError()); return false; } @@ -260,8 +241,6 @@ bool Placeholders::ConvertToPlaceholder(const std::wstring &fullPath, const std: 0, NULL); - wprintf(L"[ConvertToPlaceholder] Error details: %s\n", errorMsg); - // Liberar el buffer de mensaje de error LocalFree(errorMsg); @@ -328,7 +307,6 @@ void Placeholders::UpdateSyncStatus(const std::wstring &filePath, bool inputSync void Placeholders::UpdateFileIdentity(const std::wstring &filePath, const std::wstring &fileIdentity, bool isDirectory) { - wprintf(L"[UpdateFileIdentity] Path: %ls\n", filePath.c_str()); HANDLE fileHandle = CreateFileW( filePath.c_str(), FILE_WRITE_ATTRIBUTES, // permisson needed to change the state @@ -452,7 +430,6 @@ CF_PLACEHOLDER_STATE GetPlaceholderStateMock(const std::wstring &filePath) } } - FileState Placeholders::GetPlaceholderInfo(const std::wstring &directoryPath) { @@ -488,24 +465,12 @@ FileState Placeholders::GetPlaceholderInfo(const std::wstring &directoryPath) { SyncState syncState = syncStateOpt.value(); - - printf("placeholderInfo.SyncState: %s\n", syncStateToString(syncState).c_str()); - } - else - { - printf("placeholderInfo.SyncState: No value\n"); } if (pinStateOpt.has_value()) { PinState pinState = pinStateOpt.value(); - - printf("placeholderInfo.PinState: %s\n", pinStateToString(pinState).c_str()); - } - else - { - printf("placeholderInfo.PinState: No value\n"); } fileState.pinstate = pinStateOpt.value_or(PinState::Unspecified); @@ -607,7 +572,7 @@ HRESULT Placeholders::UpdatePinState(const std::wstring &path, const PinState st const auto cfState = pinStateToCfPinState(state); HRESULT result = CfSetPinState(handleForPath(path).get(), cfState, CF_SET_PIN_FLAG_NONE, nullptr); - + // ForceShellRefresh(path); if (result != S_OK) diff --git a/native-src/virtual_drive/Wrappers.cpp b/native-src/virtual_drive/Wrappers.cpp index e8ba0e6e..572d99b6 100644 --- a/native-src/virtual_drive/Wrappers.cpp +++ b/native-src/virtual_drive/Wrappers.cpp @@ -448,7 +448,6 @@ napi_value DisconnectSyncRootWrapper(napi_env env, napi_callback_info args) napi_value GetFileIdentityWrapper(napi_env env, napi_callback_info args) { - printf("GetFileIdentityWrapper\n"); size_t argc = 1; napi_value argv[1]; napi_get_cb_info(env, args, &argc, argv, nullptr, nullptr); @@ -466,7 +465,6 @@ napi_value GetFileIdentityWrapper(napi_env env, napi_callback_info args) napi_get_value_string_utf16(env, argv[0], reinterpret_cast(const_cast(fullPath)), pathLength + 1, nullptr); std::string fileIdentity = Placeholders::GetFileIdentity(fullPath); - printf("fileIdentity got\n"); fileIdentity.erase(std::remove(fileIdentity.begin(), fileIdentity.end(), '\0'), fileIdentity.end()); fileIdentity.erase(std::remove(fileIdentity.begin(), fileIdentity.end(), ' '), fileIdentity.end()); @@ -497,7 +495,6 @@ napi_value DeleteFileSyncRootWrapper(napi_env env, napi_callback_info args) napi_get_value_string_utf16(env, argv[0], reinterpret_cast(const_cast(fullPath)), pathLength + 1, nullptr); SyncRoot::DeleteFileSyncRoot(fullPath); - printf("fileIdentity got\n"); delete[] fullPath; return nullptr;