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

Working demo for wxFileSystemWatcher #113

Merged
merged 3 commits into from
Dec 3, 2015
Merged

Working demo for wxFileSystemWatcher #113

merged 3 commits into from
Dec 3, 2015

Conversation

halfer
Copy link
Contributor

@halfer halfer commented Dec 3, 2015

Here is a simple file watcher app, as discussed on #110. Tested on Ubuntu 14.04 with PHP 5.5.9.

There are a couple of oddities I'd draw attention to, in case you want to improve this before merging down. Firstly to watch what happens inside a folder, the watched folder must end in a trailing slash - if this behaviour is introduced by wxPHP and not wxWidgets, that might be worth looking at. (I don't have a view as to where it is introduced, but thought the behaviour was rather strange - if there is no trailing slash I imagine one would still want to know about file events directly in that folder).

Also, unlike other controls a watcher cannot be instantiated until the loop is running, and creating one in a frame constructor or app init bombs with an error (see the code comments). Ideally it could be instantiated at any time and start watching when the event loop starts, but I don't know how feasible this is (and the timer workaround feels perfectly clean). If there's a better way to delay this instantiation, do let me know.

@jgmdev
Copy link
Member

jgmdev commented Dec 3, 2015

Looks good! The trailing slash requirement may be reported at the wxwidgets bug tracker or ask them if that's the normal behavior, but I don't think it is a big issue. About the wxTimer I think it is fine too. So I will merge this now.

jgmdev added a commit that referenced this pull request Dec 3, 2015
Working demo for wxFileSystemWatcher
@jgmdev jgmdev merged commit 88785c0 into wxphp:master Dec 3, 2015
@halfer
Copy link
Contributor Author

halfer commented Dec 4, 2015

Great! OK, good idea - I will log a ticket over there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants