Fs 0.91 usage (phoenix-locked version)

Can I actually use this library to listen to a specific directory.

I tried doing

defmodule MyModule do
  use GenServer

  def start_link do
    GenServer.start_link(__MODULE__, :ok, name: __MODULE__)

  def init(:ok) do
    Application.put_env(:fs, :path, "/my-directory")
    {:ok, %{}}

  def handle_info(a, b) do
    IO.inspect a
    {:noreply, b}


but nothing happened when I changed some files. I also tried to_charlist on the path but didnt help. The 0.91 code looks something like this:

The answer was I was calling Application.put_env too late, had to set it in config files.

1 Like