[realized I sent my prior response to Neil alone.  Summary was:  Thank you!]

I see that I can get the event telling me that something changed.  As
far as I can tell the event contains no information about *what*
changed, it simply alerts that *something* changed.  Likewise, the
monitor is only for the directory that I point it at, not for the
subdirectories.  That leaves me two questions:

 - I could keep a copy of the directory state in (RAM | the DB) and
then, when I get the filesystem event, I could walk down through the
filesystem and compare against that copy to know what happened.  Is
there a better way to do this?

- Is there a way to monitor a directory and all its subdirs without
creating separate event monitors for each one?



On Thu, Jan 19, 2017 at 3:58 PM, Neil Van Dyke <[email protected]> wrote:
> David Storrs wrote on 01/19/2017 03:08 PM:
>>
>> of events but I still know nothing about detecting filesystem change
>> events.  I've looked through PLaneT and found nothing that seems like
>> an FS-monitoring package.  Can anyone suggest how to do this?
>
>
> Here's a simple example, using `sync`:
>
> #lang racket
> (define my-fs-change-evt (filesystem-change-evt "/home/user"))
> (printf "sync...~n")
> (sync my-fs-change-evt)
> (printf "synced!~n")
>
> I ran this example on GNU/Linux, and then used the command `touch
> /home/user/x`, which caused the `sync` procedure to return.
>
> See the documentation in the vicinity of that for `sync`, for other other
> ways to use synchronizable objects.  They're essential for some kinds of I/O
> programming, not just GUI.
>
> Don't be scared away by the events (and ports documentation.  I've done a
> bunch of low-level programming in C, of I/O and such, and I still find some
> of the Racket documentation for related concepts to be intimidating.  (Well,
> there is one big thing in there that's scared me off the few times I've
> wanted to use it, but each time, I was on the clock for a consulting client,
> so I did things in the known-quantity way instead.  Much of the primitives
> are simple, however, and the work is in building correct and efficient
> programs around the primitives.)
>
> BTW, You don't want "PLaneT", which was the old (and wise) package system.
> Almost all current development has moved from PLaneT to
> "pkgs.racket-lang.org".
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to