Add some temp-name dot heuristics for OS X's sake.
- Drop one leading '.' from the filename (before adding our own).
- Drop one trailing '.' from a (possibly truncated) name prior to
the .XXXXXX suffix being added.
- Allow the temp-name to collapse to just the .XXXXXX suffix
if the path is long enough to require that.
Note that we don't try to remove multiple dots from a filename
that actually has multiple consecutive dots, since we might as
well learn early if the final name is going to fail or not.