My key discovery was the library ‘kpathsea’ which does file name look up. 
And in particular ‘kpsewhich --show-path TEXFILETYPE’. So, for example, 
‘kpsewhich --show-path tfm’ returns a colon separated list of paths to tfm 
files.