Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recursive works on creating a watcher, but not for new directory additions #16

Open
jmarca opened this issue Aug 15, 2016 · 8 comments
Open

Comments

@jmarca
Copy link

jmarca commented Aug 15, 2016

Hi, just playing around with hawk, learning clojure, etc.

I noticed that if I add a directory, the watcher previously set no longer watches the new directory

For example, if I do:

(hawk/watch! [{:paths ["/tmp/darktable_exported"]
               :handler (fn [ctx e]
                          (println "event: " e)
                          (println "context: " ctx)
                          ctx)}])

and do:

mkdir /tmp/darktable_exported/August_2016

I see in the repl:

event:  {:file #object[java.io.File 0x1c5661ba /tmp/darktable_exported/August_2016], :kind :create}
context:  {}

But then when I do:

touch /tmp/darktable_exported/August_2016/1.jpg

I see nothing in the repl.

If I restart the watcher, it will see the 1.jpg addition:

boot.user=> event:  {:file #object[java.io.File 0x2c8a60ac /tmp/darktable_exported/August_2016/1.jpg], :kind :create}
context:  {}
event:  {:file #object[java.io.File 0x173395d8 /tmp/darktable_exported/August_2016/1.jpg], :kind :modify}
context:  {}

So one fix from my end is to just check if the addition is a directory, and if it is, then toggle my watcher off and on. I also read in one of the other directory watching implementations that there is some sort of bug with recursively watching new directories, so actually fixing this within hawk is likely well beyond my freshly-minted clojure skill.

@wkf
Copy link
Owner

wkf commented Aug 26, 2016

Hey, sorry about the late response. I like to think I'll have some time to review this afternoon. Thanks for the bug report!

@bhauman
Copy link

bhauman commented Nov 21, 2016

I'd like to upvote this.

@wkf
Copy link
Owner

wkf commented Nov 21, 2016

Hey, sorry folks, and thanks @bhauman for the poke. I've been fairly busy with my day job, but I'm taking a look right now.

@vans163
Copy link

vans163 commented Nov 21, 2016

il xref this bhauman/lein-figwheel#496

@wkf wkf closed this as completed in 4e27e9a Nov 21, 2016
@wkf
Copy link
Owner

wkf commented Nov 21, 2016

Hey folks, would you mind giving 0.2.11 a shot to make sure it resolves your issue? If not, I'll reopen. Thanks for your patience. 😅

@vans163
Copy link

vans163 commented Nov 22, 2016

@wkf This works for the most part. If you mv a folder though it does not watch it.

@wkf
Copy link
Owner

wkf commented Nov 23, 2016

@vans163 did you mv a folder from outside your watch folder inside your watch folder, or did you move a folder that was previously being watched?

@wkf wkf reopened this Nov 23, 2016
@vans163
Copy link

vans163 commented Nov 23, 2016

previously watched. same folder. So folder1 and folder2 is watched currently.

folder1
  - folder2

becomes

folder1
  - folder3

New/saved files in folder3 now are not tracked. Not sure if I checked moving from outside a watched folder into one. (that should be checked too)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants