Skip to content

Working demo for wxFileSystemWatcher - #113

Merged
jgmdev merged 3 commits into
wxphp:masterfrom
halfer:master
Dec 3, 2015
Merged

jgmdev merged 3 commits into
wxphp:masterfrom
halfer:master

Conversation

@halfer

@halfer halfer commented Dec 3, 2015

Copy link
Copy Markdown
Contributor

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

jgmdev commented Dec 3, 2015

Copy link
Copy Markdown
Member

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

halfer commented Dec 4, 2015

Copy link
Copy Markdown
Contributor Author

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.

2 participants