-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
[thomasmonkman-filewatch] Add patch for fixing Unix version #35236
Merged
vicroms
merged 6 commits into
microsoft:master
from
Pravila00:pabloro/fix-unix-filewatch
Nov 29, 2023
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9feec8e
Add patch
pabloromicrosoft f472715
Add patch
pabloromicrosoft 5188d23
Update version
pabloromicrosoft c2b0491
Add port-version 1
pabloromicrosoft 6e16751
Add version
pabloromicrosoft 3de4234
Restore git-tree
pabloromicrosoft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
diff --git a/FileWatch.hpp b/FileWatch.hpp | ||
index 4eba08b..2c0ff6d 100644 | ||
--- a/FileWatch.hpp | ||
+++ b/FileWatch.hpp | ||
@@ -276,7 +276,7 @@ namespace filewatch { | ||
|
||
FolderInfo _directory; | ||
|
||
- const std::uint32_t _listen_filters = IN_MODIFY | IN_CREATE | IN_DELETE; | ||
+ const std::uint32_t _listen_filters = IN_MODIFY | IN_CREATE | IN_DELETE | IN_MOVE; | ||
|
||
const static std::size_t event_size = (sizeof(struct inotify_event)); | ||
#endif // __unix__ | ||
@@ -604,7 +604,7 @@ namespace filewatch { | ||
} | ||
}(); | ||
|
||
- const auto watch = inotify_add_watch(folder, watch_path.c_str(), IN_MODIFY | IN_CREATE | IN_DELETE); | ||
+ const auto watch = inotify_add_watch(folder, watch_path.c_str(), IN_MODIFY | IN_CREATE | IN_DELETE | IN_MOVE); | ||
if (watch < 0) | ||
{ | ||
throw std::system_error(errno, std::system_category()); | ||
@@ -644,6 +644,14 @@ namespace filewatch { | ||
{ | ||
parsed_information.emplace_back(StringType{ changed_file }, Event::modified); | ||
} | ||
+ else if (event->mask & IN_MOVED_FROM) | ||
+ { | ||
+ parsed_information.emplace_back(T{ changed_file }, Event::renamed_old); | ||
+ } | ||
+ else if (event->mask & IN_MOVED_TO) | ||
+ { | ||
+ parsed_information.emplace_back(T{ changed_file }, Event::renamed_new); | ||
+ } | ||
} | ||
} | ||
i += event_size + event->len; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Please restore the original git tree back.
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.
Thanks! I've just restored the original git tree back, let me know if you need anything else from my side.