Le 20/08/2013 15:46, Henry Vermaak a écrit :
On Tue, Aug 20, 2013 at 03:21:01PM +0200, Antonio Fortuny wrote:
Le 20/08/2013 14:56, Henry Vermaak a écrit :
On Tue, Aug 20, 2013 at 02:22:02PM +0200, Antonio Fortuny wrote:
Hi Folks.

Do you know any component / tool to allow an application to be
notified by the host OS when something changes in a disk directory ?
Both Windows & Linux.
inotify on linux (together with select()).  I'm told
Couldn'f find any inotify.* unit into my FPC/Lazarus installation
Only an inotify.h
It's in the linux unit, since inotify is linux specific.

FindFirstChangeNotification() is the thing to use on Windows, but I've
never tried.
I did and it runs OK as it is part of the kernel32.dll. But I'll
have to run into a loop as this shell function is not event driven.
I'll maybe make a wrapper onto it using a separated thread.
You can use a wait function (e.g. WaitForMultipleObjects) with the
handle that FindFirstChangeNotification() returns.  So start a thread,
get the handle, use wait function and call an event when the wait
function indicated that something happened with the handle.  Repeat.
This was in my mind too.

You'll have to do something similar for the linux implementation: start
a thread, get inotify fd, add that to fpselect(), call some event
when fpselect() indicates that the fd is readable. Repeat.
I'll try a little bit later.

Thanks,

Antonio.


Henry

--
Sita
                Software
Antonio Fortuny
Senior Software engineer

220, avenue de la Liberté
L-4602 Niederkorn
Tel.: +352 58 00 93 - 93
www.sitasoftware.lu
Your IT Partner
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to