Listen for file system change

Hi,

I’m trying to do the following :smiley:

  1. Open MyAwesomeApp.exe
  2. New file (jpg) is stored on MyAwesomeApp/data/img/
  3. MyAwesomeApp.exe reads the new file and displays it

Basically I need a file system listener so when a new file is added I display it. How would you do it?

I have found a file system listener in java but it appears to me that it’s not necesary because there might be something that helps me in C++

The simplest way would probably be to just poll the directory continuously in another thread and see if any new files were added since the last time.

I’m not sure which filesystems have explicit watchers for such things.

A slightly more complicated but cross platform way to do it would be to use this framework:
http://code.google.com/p/simplefilewatcher/

[quote author=“nemik”]The simplest way would probably be to just poll the directory continuously in another thread and see if any new files were added since the last time.

I’m not sure which filesystems have explicit watchers for such things.[/quote]

I don’t know if that’s very simple to implement, forgot to say that I’m not expert in C++ :smiley:

[quote author=“grimus”]A slightly more complicated but cross platform way to do it would be to use this framework:
http://code.google.com/p/simplefilewatcher/[/quote]

This looks incredible. Will take a deeper look.

Thank you

hi @Alejandro did you make progress with it? I’m trying to do the same thing right now and I’m looking for possibilities.

In ofxIO there are examples for this.

1 Like

Nice! Thanks! @bakercp

I’m trying to run the examples using 0.8.4 and I was getting a lot of errors. I just tried using 0.9.0 and everything is ok!
Thank you so much. great work!

hi! @bakercp

I uninstalled XCode 7, and I came back to Xcode 6.4 because OF 0.9 has some dificulties with some addons that I using now.

XCode 6.4
Yosemite 10.10.5
OF 0.8.4

Can you help me to get my app work again?

No type named ‘mutex’ in namespace ‘std’, now I’m stucked in this error.

the app is completely blank, I just imported the addons.

ofxHTTP
ofxIO
ofxMediaType
ofxNetworkUtils
ofxSSLManager
ofxTaskQueue

thks in advance!