use getcwd() instead of exec('pwd')

This will now also work on OSs thats don't have a pwd command