Borrow some code from zenformat, fix a file check.