Fix issue with cfgdir when the path to the config has a blank dirname