Move file related functions to their own module.
Better error? No. But a little nicer.
Use filelib instead of my own implementations.

Thanks @aerosol :)
Ignore ebin dir.