Watching for folder changes

Not sure where to put this, so I figure General would be the best slot.
I was tinkering with an app the other day and realised I needed a way for my application to respond to changes in a project folder (project for the application, not the Xojo project).
In C#, this is quite easy, but I couldn’t see an out of the box way with Xojo (I am using the classic framework).
So, I write my own :slight_smile:
If anyone is interested, or has comments, I have added a new blog entry (been way too long), here: https://pengwindev.blogspot.com/2019/05/watching-folder.html

macOS - file system events https://developer.apple.com/documentation/coreservices/file_system_events
I think there’s some of this already in macOSLib

I’d guess there’s something similar on Windows & Linux that could be declared into

And that Christian even has a plugin for this

Thanks for that Norman.

I was trying to avoid declares, so macOSLib would probably not been the way to go, and, with all due respect to Christian, et al, I prefer to write my own rather than use plug ins. I code in Xojo mainly for my own stuff, and working out how to do things is half the fun :slight_smile:

We have FSEventsMBS class for MacOS in MBS Xojo MacFrameworks Plugin.
And WindowsDirectoryWatcherMBS class for Windows in MBS Xojo Win Plugin.

@Christian Schmitz Hi Christian, I thought you probably would have a plug-in for this, but as I said, I prefer to work out how to do it myself. My code may not be the most efficient, but I like to see what native Xojo can do if you put your mind to it. And in doing so, I feel I is only fair to share what I come up with, with the community.

You are welcome to check out the MBS Xojo Plugins.
A lot of stuff with 2500 classes and 2000 examples.

Also check the European Xojo Conference!

PS: Trial licenses are available here.

Again, with all due respect. I have stated twice that I prefer not to use plugins. I wasn’t even looking for assistance in creating a method or class, I was offering a home grown option to the community, with details on how to create it.

I understand that your plugins are very widely used within the community, Christian, but I choose not to use them as I am on a tight budget and I enjoy tinkering, I also like to explore all avenues before committing to purchasing someone else’s code.

Please, before you start touting your wares in a thread created by myself, check out what has already been posted. If I want a plugin solution, I will ask for it.

In this thread alone, with only 7 posts (8 now), 2 are basically adverts for your plugins.
I am sorry if I sound harsh, but I have noticed this before in other threads, and in any other community, it would be classified as spam.

Well, I may point to the face that watching folder for changes may need a preemptive thread to do it. WindowsDirectoryWatcherMBS uses one internally. And as Xojo is not safe to use with preemptive thread, we encapsulate that in the plugin.

So for some things it may be possible to do it in Xojo, but some things may not be doable!

PS: if you are a young developer (student?), you could just ask for a free license. We support young people when possible.

Not a young developer, Christian. I have been developing software since 1983. I have worked in the software industry since 1998, developing a range of software from larger ERP solutions on IBM mid-range, to games and applications on modern desktops, to government funded projects. I post threads like this one to share with the community.