Better filepath handling

This makes a function which allows us to get the current working
directory for the script. I need this to access files from multiple parts
of the system. Without this the script was failing when run outside of
it's own directory, which is silly.