Closed TinaMor closed 10 months ago
The looks good to me. I've noticed a few issues while try to test your code.
LogFilesChangeHandler: Timer event
even after the log file is created and I'm pushing data to that log file.LogFilesChangeHandler: Timer event
Is this the expected behavior and I'm not sure if it is related to this PR as well?
@bobsira I accidentally uncommeted out code
The looks good to me. I've noticed a few issues while try to test your code.
- If I begin monitoring the C: without having a log file and create the logfile later on I keep getting
LogFilesChangeHandler: Timer event
even after the log file is created and I'm pushing data to that log file.- If I begin monitoring the C: with a log file already there I still see the
LogFilesChangeHandler: Timer event
Is this the expected behavior and I'm not sure if it is related to this PR as well?
PR Description
This PR allows us to monitor files in the root directory e.g. C:\
Solution
For root directory, do not prepend, otherwise, prepend "\?\" to the directory path. We validate the config file to check that when the root directory is provided,
includeSubdirectories
must befalse
. Otherwise, the appliation terminates with an error.TL;DR
By default, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, we prepend "\?\" to the path in LogFileMonitor.cpp. Prepending the string "\?\" does not allow access to the root directory. Maximum Path Length Limitation In editions of Windows before Windows 10 version 1607, the maximum length for a path is MAX_PATH, which is defined as 260 characters. In later versions of Windows, changing a registry key or using the Group Policy tool is required to remove the limit. See Maximum Path Length Limitation for full details. There is no limit on the depth of a file or directory. With the standard API you can create as many folders as you want until the actual length of the expanded path exceeds 32,767 characters. The math on that is 2¹⁵ minus 1. The limitation of 32,767 doesn’t come from NTFS. It comes from the Win32 API.
References