5HT / fs

📁 FS: Windows, Linux, Mac Driver
https://fs.n2o.dev
Other
234 stars 69 forks source link

Watcher on macOS not emitting event #72

Open ghivert opened 2 months ago

ghivert commented 2 months ago

Hi!

I'm trying to use fs with start_link on macOS (last version, 14.4.1, with Erlang/OTP 26), to watch my source files, and I don't know if I'm using it wrongly or if I encountered a bug. I have a minimal reproducible example here:

The structure of the project is:

fs_test
├─ rebar.config
└─ src
   ├─ module_2.erl
   └─ fs_test.erl

And in fs_test.erl, I have

-module(fs_test).

-export([main/1]).

main(_) ->
    fs:start_link(file_watcher, "src"),
    fs:start_looper(file_watcher),
    timer:sleep(infinity).

I'm launching the script from the root folder (fs_test here), and when I try to save or modify any file in src folder, nothing happen. However, when I change fs:start_link(file_watcher, "src") to fs:start_link(file_watcher, "."), it's working. I can live with the workaround right now, but I'd like to understand what's happening under the hood. 🙂

Am I missing something? Should I avoid relative links with fs?