Closed rufuszhou closed 4 years ago
Can you give me a more detailed description of the issue which is fixed by your PR. Or maybe you can provide a test case.
It is a problem only when watching a file. A "/" is often appended to the file path, like below:
# ./inotify_example /tmp/a.txt
Event modify on "/tmp/a.txt/" at 276237699902451 was triggered.
Event open on "/tmp/a.txt" at 276237699960573 was triggered, but was not expected
Event modify on "/tmp/a.txt/" at 276237700096391 was triggered.
Event close_write on "/tmp/a.txt" at 276237700100407 was triggered, but was not expected
And sometimes, I saw a unprintable character appended after "/". But sorry, I don't know how to reproduce it now.
I'm working on a OpenSUSE Leap 15.1.
Okay, let me try to reproduce it and maybe write a test case for it.
I can confirm that there is an issue. I tried to fix it with #66 but some unit tests failed. I am on it.
About your code changes in #66. event->name
can be the name of a file, and it is also possible to be of a new folder. So I think one if (fs::is_directory(path))
check is not enough.
You are right, I updated the pr. Should be fine now.
Fixed with #66 thank you for the contribution!
to avoid appending "/" to the file name when watching a file.