trim spaces and directory separators on paths

This means that we always has to add a / when concatenating paths as we
should do. This is more consistent and also gets rid of the double slashes.