X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=dirwatcher.ml;fp=dirwatcher.ml;h=667eba7f2f740417ac97cd55e1c07522a64ba57d;hb=542f2c4d52a5a1113ba9017cb0ee70304393fac4;hp=31226427f80f94d43d4f89e7ec18a09155b934ca;hpb=acbdd1601fcfb161089d326e7e32b74b76f441e3;p=vsys.git diff --git a/dirwatcher.ml b/dirwatcher.ml index 3122642..667eba7 100644 --- a/dirwatcher.ml +++ b/dirwatcher.ml @@ -33,19 +33,19 @@ let add_watch dir events handler = (* Ignore the possibility that the whole directory can disappear and come * back while it is masked *) -let mask_watch dir file = +let mask_watch fqp = try - Hashtbl.replace masks (dir,file) true + Hashtbl.replace masks fqp true with _ -> () -let unmask_watch dir file = - if (Hashtbl.mem masks (dir,file)) then +let unmask_watch fqp = + if (Hashtbl.mem masks fqp) then begin - Hashtbl.remove masks (dir,file) + Hashtbl.remove masks fqp end else - fprintf logfd "WARNING: %s,%s -- Unpaired unmask\n" dir file;flush logfd + fprintf logfd "WARNING: %s -- Unpaired unmask\n" fqp;flush logfd let asciiz s = let rec findfirstnul str idx len = @@ -71,9 +71,12 @@ let receive_event (eventdescriptor:fname_and_fd) (bla:fname_and_fd) = match handler with | None->fprintf logfd "Unhandled watch descriptor\n";flush logfd | Some(handler)-> - let mask_filter = Hashtbl.mem masks (dirname,purestr) in + let fqp = String.concat "/" [dirname;purestr] in + let mask_filter = Hashtbl.mem masks fqp in if (not mask_filter) then + begin handler wd dirname evlist purestr + end end | _ -> ()) evs