Fix #50 template not found on Windows OSes.

This PR supersedes  #52 and closes #50.

@birdage I tested this PR with some simple Windows and Linux examples.  (But we should add a proper test later to avoid re-surfacing this bug with future changes.)