From 000e447cb98aae911700a069f3fd563ded584d24 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Mon, 5 Sep 2016 01:48:42 +0200 Subject: [PATCH] Fix "Folder as Workspace" not updating regression --- PowerEditor/src/NppIO.cpp | 9 ++++++++- .../ReadDirectoryChanges/ReadDirectoryChangesPrivate.cpp | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/PowerEditor/src/NppIO.cpp b/PowerEditor/src/NppIO.cpp index df29ce05..ea887e57 100644 --- a/PowerEditor/src/NppIO.cpp +++ b/PowerEditor/src/NppIO.cpp @@ -87,7 +87,14 @@ DWORD WINAPI Notepad_plus::monitorFileOnChange(void * params) else { changes.Pop(dwAction, wstrFilename); - if (lstrcmp(fullFileName, wstrFilename.GetString()) == 0) + generic_string fn = wstrFilename.GetString(); + + // Fix monitoring files which are under root problem + size_t pos = fn.find(TEXT("\\\\")); + if (pos == 2) + fn.replace(pos, 2, TEXT("\\")); + + if (lstrcmp(fullFileName, fn.c_str()) == 0) { if (dwAction == FILE_ACTION_MODIFIED) { diff --git a/PowerEditor/src/WinControls/ReadDirectoryChanges/ReadDirectoryChangesPrivate.cpp b/PowerEditor/src/WinControls/ReadDirectoryChanges/ReadDirectoryChangesPrivate.cpp index f2d648a1..5f9cd4e5 100644 --- a/PowerEditor/src/WinControls/ReadDirectoryChanges/ReadDirectoryChangesPrivate.cpp +++ b/PowerEditor/src/WinControls/ReadDirectoryChanges/ReadDirectoryChangesPrivate.cpp @@ -149,7 +149,7 @@ void CReadChangesRequest::ProcessNotification() CStringW wstrFilename(fni.FileName, fni.FileNameLength/sizeof(wchar_t)); // Handle a trailing backslash, such as for a root directory. - if (m_wstrDirectory.Right(1) != L"\\") + if (wstrFilename.Right(1) != L"\\") wstrFilename = m_wstrDirectory + L"\\" + wstrFilename; else wstrFilename = m_wstrDirectory + wstrFilename;