Thread overview
Is there anything in the standard library to help writing a file watcher?
May 23, 2013
Gary Willoughby
May 23, 2013
Benjamin Thaut
May 23, 2013
David
May 23, 2013
Jacob Carlborg
May 23, 2013
Gary Willoughby
Jul 15, 2013
Zz
May 23, 2013
Is there anything in the standard library to help writing a file watcher? I want to monitor a single file for changes and if a change is detected call a function. Is there any existing libraries to do this in D as it must be cross-platform as much as possible?
May 23, 2013
Am 23.05.2013 17:26, schrieb Gary Willoughby:
> Is there anything in the standard library to help writing a file
> watcher? I want to monitor a single file for changes and if a change is
> detected call a function. Is there any existing libraries to do this in
> D as it must be cross-platform as much as possible?

I have something like this implemented for windows. It watches a entire directory including subdirectories (optional) and tells you which files changed upon request:

https://github.com/Ingrater/thBase/blob/master/src/thBase/directory.d

I don't think its possible to imiplement this cross-plattform. You will have to reimplement for every plattform you need it on.

Kind Regards
Benjamin Thaut
May 23, 2013
Am 23.05.2013 17:35, schrieb Benjamin Thaut:
> Am 23.05.2013 17:26, schrieb Gary Willoughby:
>> Is there anything in the standard library to help writing a file watcher? I want to monitor a single file for changes and if a change is detected call a function. Is there any existing libraries to do this in D as it must be cross-platform as much as possible?
> 
> I have something like this implemented for windows. It watches a entire directory including subdirectories (optional) and tells you which files changed upon request:
> 
> https://github.com/Ingrater/thBase/blob/master/src/thBase/directory.d
> 
> I don't think its possible to imiplement this cross-plattform. You will have to reimplement for every plattform you need it on.
> 
> Kind Regards
> Benjamin Thaut

For Linux you can use inotify

http://linux.die.net/man/7/inotify
May 23, 2013
On 2013-05-23 18:19, David wrote:

> For Linux you can use inotify
>
> http://linux.die.net/man/7/inotify

I think the corresponding for Mac OS X is fsevents:

http://en.wikipedia.org/wiki/FSEvents

-- 
/Jacob Carlborg
May 23, 2013
Hmmm.. this is what i first thought. I think i'll implement a simple watcher based on modification times as a first iteration. Then if time allows add platform specific solutions based on the above. Thanks.
July 15, 2013
https://code.google.com/p/simplefilewatcher/

may help with platform specific solutions.

On Thursday, 23 May 2013 at 18:56:41 UTC, Gary Willoughby wrote:
> Hmmm.. this is what i first thought. I think i'll implement a simple watcher based on modification times as a first iteration. Then if time allows add platform specific solutions based on the above. Thanks.