Replace THORN_NAME in merged files

Pass thorn structure to mergeFiles too allow expanding "templates" such as @THORN_NAME@.