On Mon, Oct 12, 2009 at 7:27 AM, Axis43 <[email protected]> wrote:
>
> As an exercise I am moving some stuff I wrote in c# to Clojure.
>
> One part of the program I am porting watches a folder for new files of
> a specified type using .Net's FileWatcher.  I was wondering if anyone
> has done done something similar in Clojure and/or can point me in the
> right direction to a solution.  I know there is equivalent
> functionality coming in NIO2 as part of Java 7.
>
> Any assistance greatly appreciated

The fact that you mention .Net probably means this linux-only
solution won't be useful for you.  But just in case it is...

http://github.com/Chouser/clojure-jna/blob/master/src/net/n01se/clojure_jna/linux.clj

; Example usage:

(def x (iinit))

(add-iwatch x "/tmp" (flags-mask create delete)
            #(if (:create (:flags %))
               (println "Created file" (:name %) "in /tmp")
               (println "Deleted file" (:name %) "in /tmp")))

(def wd (add-iwatch x "/tmp" (flags-mask moved) prn))
(rm-iwatch x wd)

(iclose x)

--Chouser

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to