templater: don't search randomly for templates - trust util.datapath
The search was introduced in
2653740d8118. It might have been necessary back
then when using __file__ directly and frozen-ness wasn't considered. Now we
should know exactly where the templates can be found.
templater: introduce templatepaths for getting paths searched for templates
Avoid function with different return types depending on parameters.
util: introduce datapath for getting the location of supporting data files
templates, help and locale data is normally stored as sub folders in the
directory containing the source of the mercurial module. In a frozen build they
live as sub folders next to 'hg.exe' and 'library.zip'.
These different kind of data were handled in different ways. Unify that by
introducing util.datapath. The value is computed from the environment and is
always used, so we just calculate the value on module load.