Skip to content

Commit

Permalink
Fix logs.
Browse files Browse the repository at this point in the history
Signed-off-by: Camila Ayres <hello@camilasan.com>
  • Loading branch information
camilasan committed Oct 10, 2024
1 parent c898582 commit 4003502
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
11 changes: 8 additions & 3 deletions shell_integration/windows/NCOverlays/NCOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ NCOverlay::NCOverlay(int state)
: _referenceCount(1)
, _state(state)
{
m_logger.open("c:\\testOverlay.log");
m_logger << "hello world" << std::endl;
// it is saved under %userprofile%
m_logger.open("C:\\overlay.log");
m_logger << "debug" << std::endl;
}

NCOverlay::~NCOverlay(void)
Expand Down Expand Up @@ -122,10 +123,11 @@ IFACEMETHODIMP NCOverlay::GetPriority(int *pPriority)

IFACEMETHODIMP NCOverlay::IsMemberOf(PCWSTR pwszPath, DWORD dwAttrib)
{
RemotePathChecker* checker = getGlobalChecker(m_logger);
auto checker = getGlobalChecker(m_logger);
std::shared_ptr<const std::vector<std::wstring>> watchedDirectories = checker->WatchedDirectories();

if (watchedDirectories->empty()) {
m_logger << "list of watched directories are empty" << std::endl;
return MAKE_HRESULT(S_FALSE, 0, 0);
}

Expand All @@ -138,13 +140,16 @@ IFACEMETHODIMP NCOverlay::IsMemberOf(PCWSTR pwszPath, DWORD dwAttrib)
}

if (!watched) {
m_logger << "watched is false" << std::endl;
return MAKE_HRESULT(S_FALSE, 0, 0);
}

int state = 0;
if (!checker->IsMonitoredPath(pwszPath, &state)) {
m_logger << "not monitored path: " << pwszPath << std::endl;
return MAKE_HRESULT(S_FALSE, 0, 0);
}

return MAKE_HRESULT(state == _state ? S_OK : S_FALSE, 0, 0);
}

Expand Down
6 changes: 3 additions & 3 deletions shell_integration/windows/NCUtil/RemotePathChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void RemotePathChecker::workerThreadLoop(ofstream &logger)
if (!asked.count(filePath)) {
asked.insert(filePath);
if (!socket.SendMsg(wstring(L"RETRIEVE_FILE_STATUS:" + filePath + L'\n').data(), logger)) {
MessageBox(nullptr, L"stopping thread - socket.SendMsg RETRIEVE_FILE_STATUS returned false", L"Debugging", MB_OK);
//MessageBox(nullptr, L"stopping thread - socket.SendMsg RETRIEVE_FILE_STATUS returned false", L"Debugging", MB_OK);
_stop = true;
logger << "stopping thread - socket.SendMsg RETRIEVE_FILE_STATUS returned false" << std::endl;
break;
Expand All @@ -78,13 +78,13 @@ void RemotePathChecker::workerThreadLoop(ofstream &logger)
if (!socket.ReadLine(&response, logger)) {
socket.Close();
logger << "closing socket, no more data to read" << std::endl;
MessageBox(nullptr, L"closing socket, no more data to read", L"Debugging", MB_OK);
//MessageBox(nullptr, L"closing socket, no more data to read", L"Debugging", MB_OK);
break;
}

if (response.empty()) {
logger << "closing socket, response is empty" << std::endl;
MessageBox(nullptr, L"closing socket,response is empty", L"Debugging", MB_OK);
//MessageBox(nullptr, L"closing socket,response is empty", L"Debugging", MB_OK);
break;
}

Expand Down

0 comments on commit 4003502

Please sign in to comment.