Changeset 54
- Timestamp:
- 04/16/09 21:01:49 (3 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
-
directory_watcher.erl (modified) (1 diff)
-
directory_watcher_test.erl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/directory_watcher.erl
r53 r54 65 65 loop_recursive (Directory, Pid, Watchers); 66 66 check -> 67 lists: foreach (fun (P) -> P ! check end, Watchers); 67 lists: foreach (fun (P) -> P ! check end, Watchers), 68 loop_recursive (Directory, Pid, Watchers); 68 69 stop -> 69 70 notify (Pid, bye) -
trunk/src/directory_watcher_test.erl
r53 r54 37 37 38 38 recursive () -> 39 Subsub = {directory, "subsubdir", 40 [{file, "subsubfile.sub", "titi"}]}, 39 41 Tree = [{file, "foo.txt", "Hello"}, 40 42 {file, "bar.txt", "G'day"}, 41 43 {file, "toto.erl", "-module(toto)."}, 42 {directory, "subdir", [{file, "subfile.ext", "toto"}]}], 44 {directory, "subdir", 45 [{file, "subfile.ext", "toto"}, 46 Subsub]}], 43 47 ok = fixtures: use_tree (Tree, fun recursive/2). 44 48 45 49 recursive (Dir, _) -> 46 50 Watcher = spawn_link (directory_watcher, init_recursive, [Dir, self ()]), 47 Filename = filename: join ([Dir, "subdir", "subfile.ext"]), 48 Expected = {{file, ".ext"}, Filename, found}, 49 ok = receive_until_found (Expected). 51 Subdir = filename: join (Dir, "subdir"), 52 Found_subdir = {directory, Subdir, found}, 53 ok = receive_until_found (Found_subdir), 54 Subfile = filename: join (Subdir, "subfile.ext"), 55 Found_subfile = {{file, ".ext"}, Subfile, found}, 56 ok = receive_until_found (Found_subfile), 57 Subsubfile = filename: join ([Subdir, "subsubdir", "subsubfile.sub"]), 58 Found_subsub = {{file, ".sub"}, Subsubfile, found}, 59 ok = receive_until_found (Found_subsub), 60 ok = file: write_file (Subsubfile, "not titi"), 61 Watcher ! check, 62 Change_subsub = {{file, ".sub"}, Subsubfile, changed}, 63 ok = receive_until_found (Change_subsub). 50 64 51 65 bad_symlinks_are_ignored (Dir, _) ->
Note: See TracChangeset
for help on using the changeset viewer.
