This doesn't actually work if `name` and `ext` are both too long:

```pycon
>>> import os
>>> orig_name = 'name'*200 + '.' + 'ext'*200
>>> name, ext = os.path.splitext(orig_name)
>>> name = name[:255 - len(ext)] + ext[:255]
>>> len(name)
709
```