Use the tools library to determine file extension

The previous code determined the extension by splitting the file path on a dot
(.), which failed when the file path contains dots in folder names.

This commit fixes issue #14
8 jobs for devel in 52 minutes and 28 seconds (queued for 3 seconds)