Use dirname to force the directory structure to be correct.