Add before_add_file hook to add_file method