Packages

A fork of 'fs': A native file system listener fo macos, win, & linux

Current section

Files

Jump to
fs_erlsci src fs_demo.erl
Raw

src/fs_demo.erl

-module(fs_demo).
-include_lib("fs/include/const.hrl").
-export([start_looper/0,
start_looper/1]).
% sample subscriber
start_looper() -> start_looper(?DEFAULT_NAME).
start_looper(Name) ->
spawn(fun () ->
fs:subscribe(Name),
loop()
end).
loop() ->
receive
{_Pid, {fs, file_event}, {Path, Flags}} ->
logger:debug("file_event: ~p ~p", [Path, Flags]);
_ -> ignore
end,
loop().