Extract the handling of directories of manifests into a separate file.