factor out public-dir