Add support for directories in profile paths

This branch currently contains an unaltered patch from Roland Mainz to add support for directories in profile paths.