Skip to content

Commit

Permalink
adapter/windows: shorthand event
Browse files Browse the repository at this point in the history
  • Loading branch information
Will committed Jul 13, 2024
1 parent efe9d38 commit 9bc0154
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Binary file removed a.out
Binary file not shown.
10 changes: 6 additions & 4 deletions devel/include/detail/wtr/watcher/adapter/windows/watch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,12 @@ inline auto do_event_send(
watch_event_proxy& w,
::wtr::watcher::event::callback const& callback) noexcept -> bool
{
using namespace ::wtr::watcher;

struct RenameEventTracker {
std::filesystem::path path_name;
enum ::wtr::watcher::event::effect_type effect_type;
enum ::wtr::watcher::event::path_type path_type;
enum event::effect_type effect_type;
enum event::path_type path_type;
bool set = false;
};

Expand All @@ -135,11 +137,11 @@ inline auto do_event_send(
RenameEventTracker new_tracker;
auto const trigger_rename_callback = [&]()
{
auto renamed_from = ::wtr::watcher::event{
auto renamed_from = event{
old_tracker.path_name,
old_tracker.effect_type,
old_tracker.path_type};
auto renamed_to = ::wtr::watcher::event{
auto renamed_to = event{
new_tracker.path_name,
new_tracker.effect_type,
new_tracker.path_type};
Expand Down
10 changes: 6 additions & 4 deletions include/wtr/watcher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1846,10 +1846,12 @@ inline auto do_event_send(
watch_event_proxy& w,
::wtr::watcher::event::callback const& callback) noexcept -> bool
{
using namespace ::wtr::watcher;

struct RenameEventTracker {
std::filesystem::path path_name;
enum ::wtr::watcher::event::effect_type effect_type;
enum ::wtr::watcher::event::path_type path_type;
enum event::effect_type effect_type;
enum event::path_type path_type;
bool set = false;
};

Expand All @@ -1864,11 +1866,11 @@ inline auto do_event_send(
RenameEventTracker new_tracker;
auto const trigger_rename_callback = [&]()
{
auto renamed_from = ::wtr::watcher::event{
auto renamed_from = event{
old_tracker.path_name,
old_tracker.effect_type,
old_tracker.path_type};
auto renamed_to = ::wtr::watcher::event{
auto renamed_to = event{
new_tracker.path_name,
new_tracker.effect_type,
new_tracker.path_type};
Expand Down

0 comments on commit 9bc0154

Please sign in to comment.