Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion native-src/placeholders_interface/PlaceHolderInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ FileHandle handleForPath(const std::wstring &wPath)
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> 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);
Expand Down
39 changes: 2 additions & 37 deletions native-src/placeholders_interface/Planceholders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 (...)
Expand All @@ -112,21 +108,14 @@ 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)
{
std::string itemIdentityStr(len, 0);
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);
Expand All @@ -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(
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -452,7 +430,6 @@ CF_PLACEHOLDER_STATE GetPlaceholderStateMock(const std::wstring &filePath)
}
}


FileState Placeholders::GetPlaceholderInfo(const std::wstring &directoryPath)
{

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 0 additions & 3 deletions native-src/virtual_drive/Wrappers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -466,7 +465,6 @@ napi_value GetFileIdentityWrapper(napi_env env, napi_callback_info args)
napi_get_value_string_utf16(env, argv[0], reinterpret_cast<char16_t *>(const_cast<wchar_t *>(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());

Expand Down Expand Up @@ -497,7 +495,6 @@ napi_value DeleteFileSyncRootWrapper(napi_env env, napi_callback_info args)
napi_get_value_string_utf16(env, argv[0], reinterpret_cast<char16_t *>(const_cast<wchar_t *>(fullPath)), pathLength + 1, nullptr);

SyncRoot::DeleteFileSyncRoot(fullPath);
printf("fileIdentity got\n");

delete[] fullPath;
return nullptr;
Expand Down