Simplify test for file extension, just a function will do.