greatly simplified code to handle location of package cache directories