join dir and configfilename in a smarter way