Skip to content
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
merged 6 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions ports/thomasmonkman-filewatch/fix-unix-listen.patch
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;
2 changes: 2 additions & 0 deletions ports/thomasmonkman-filewatch/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ vcpkg_from_github(
REF a59891baf375b73ff28144973a6fafd3fe40aa21
SHA512 9a110b42a499ed7047bb8a79029134943582b388db810974ad6b5f91d1ec720e45a9a3543c4a56ee97d51439f5a34222bada0fb43281dcbc2e65bdee38f836d5
HEAD_REF master
PATCHES
fix-unix-listen.patch
)

file(COPY "${SOURCE_PATH}/FileWatch.hpp" DESTINATION "${CURRENT_PACKAGES_DIR}/include/thomasmonkman-filewatch")
Expand Down
1 change: 1 addition & 0 deletions ports/thomasmonkman-filewatch/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "thomasmonkman-filewatch",
"version-date": "2023-01-16",
"port-version": 1,
"description": "File watcher in C++.",
"homepage": "https://github.com/ThomasMonkman/filewatch",
"license": "MIT"
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -8338,7 +8338,7 @@
},
"thomasmonkman-filewatch": {
"baseline": "2023-01-16",
"port-version": 0
"port-version": 1
},
"thor": {
"baseline": "2022-04-16",
Expand Down
5 changes: 5 additions & 0 deletions versions/t-/thomasmonkman-filewatch.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "6dede6ba1ac505ea4bd64c60bf97edfe7b8d5647",
"version-date": "2023-01-16",
"port-version": 1
},
Copy link
Contributor

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.

Copy link
Contributor Author

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.

{
"git-tree": "09215796e0a4591e54d9aa37ab46dc5edc7bd491",
"version-date": "2023-01-16",
Expand Down