export to correct directory even if sub-directories

Without this change, if you use an `out` directory and your templates are in sub-directories, the directory structure gets squished. Think you had controllers and views per controller, then that hierarchy gets flattened.

This patch fixes that issue.