Michael Droettboom <mdroe@...86...> writes:
One possible solution is to calculate a hash of the file and key off
of that (with an I/O penalty, of course). I vaguely recall that keying
off of the Postscript name embedded in the file wasn't good enough.
How about checking first the size of the file, assuming that
os.stat('filename').st_size is sensible on Windows? If the size matches
an existing file, compute a hash of the contents of both to see if they
are the same, and in any case, memoize the results so that future checks
of the exact same filename are fast. That way you only incur the cost of
the hash if the same file is included with multiple names, or in the
rare case that two different files have the same size.
Jouni K. Seppänen