-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Fix] Bug 34: Monitor files at Windows root directory #154
Conversation
1b93082
to
f9d4a5e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, let’s fix the linting issues and we should be good to go
28bd738
to
eafc665
Compare
The looks good to me. I've noticed a few issues while try to test your code.
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
|
eafc665
to
a0baf65
Compare
a0baf65
to
d7be080
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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 application 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