patch-generating function added to File class