Fix incorrect handling of nested paths when generating string files