method mkdir rp perm =
    match rp with Relpath(rel) ->
      let fqp = String.concat "/" [root_dir;rel] in
        try 
          let s = Unix.stat fqp in
            if (s.st_kind<>S_DIRthen
              begin
                Unix.unlink fqp;
                Unix.mkdir fqp perm
              end
            else if (s.st_perm <> perm) then
              begin
                Unix.rmdir fqp;
                Unix.mkdir fqp perm
              end;
        with Unix.Unix_error(_,_,_) ->
          Unix.mkdir fqp perm;
          Directfifowatcher.add_dir_watch fqp