Fix bug of monitoring not working for files under root

Closes #2061
To reproduce such bug, the file foo.txt to monitor should be in the root folder (ie. c:\foo.txt).
The algorithm is check if folder path has '\' at the end, if no, then add a '\' then append file name.
In the original code, instead of checking folder path, the file name is checked. Since file name doesn't contain '\' (ie. c:\temp), a '\' is always added on folder path which has no '\' at the end. it works for none root folder such as C:\, E:\ or F:\.
This commit is contained in:
willdevgh 2016-07-08 19:13:54 +08:00 committed by Don HO
parent 83f291acf8
commit 52df792cd9

View File

@ -149,7 +149,7 @@ void CReadChangesRequest::ProcessNotification()
CStringW wstrFilename(fni.FileName, fni.FileNameLength/sizeof(wchar_t)); CStringW wstrFilename(fni.FileName, fni.FileNameLength/sizeof(wchar_t));
// Handle a trailing backslash, such as for a root directory. // Handle a trailing backslash, such as for a root directory.
if (wstrFilename.Right(1) != L"\\") if (m_wstrDirectory.Right(1) != L"\\")
wstrFilename = m_wstrDirectory + L"\\" + wstrFilename; wstrFilename = m_wstrDirectory + L"\\" + wstrFilename;
else else
wstrFilename = m_wstrDirectory + wstrFilename; wstrFilename = m_wstrDirectory + wstrFilename;