<commit_before>/*
* This file is part of ATLAS. It is subject to the license terms in
* the LICENSE file found in the top-level directory of this distribution.
* (Also avialable at http://www.apache.org/licenses/LICENSE-2.0.txt)
* You may not use this file except in compliance with the License.
*/

#include <iostream>
#include "ColladaRecursiveImporter.hpp"
#include "../../internal/Exception.hpp"
#include <boost/format.hpp>
#include <Poco/File.h>

namespace AssimpWorker {

	using ATLAS::Model::DataDeletingBlob;
	using ATLAS::Model::Folder;

	ColladaRecursiveImporter::ColladaRecursiveImporter(const Poco::URI& colladaFileURI, Log& log, ColladaMassagerRegistry& registry) :
		Importer(colladaFileURI.toString(), log),
		colladaFileURI(colladaFileURI),
		childImporter(),
		importer(nullptr),
		massagerRegistry(registry),
		massager(nullptr)
	{
		return;
	}

	ColladaRecursiveImporter::ColladaRecursiveImporter(const Poco::URI& colladaFileURI, Log& log, const ColladaRecursiveImporter& parent) :
		Importer(colladaFileURI.toString(), log),
		colladaFileURI(colladaFileURI),
		childImporter(),
		importer(nullptr),
		massagerRegistry(parent.massagerRegistry),
		massager(nullptr)
	{
		return;
	}

	ColladaRecursiveImporter::~ColladaRecursiveImporter(){
		delete importer;
		for (auto ci : childImporter){
			delete ci;
		}
	}

	void ColladaRecursiveImporter::addElementsTo(Folder& root){
		if (!fileExists()) {
			return;
		}
		preprocessCollada();
		const aiScene* scene = runAssimpImport();
		convertToFolderStructure(scene, root);
		importChildColladas(root);
	}

	bool ColladaRecursiveImporter::fileExists() const {
		Poco::File colladaFile(colladaFileURI.getPath());
		return colladaFile.exists() && colladaFile.canRead();
	}
<commit_msg>ColladaRecursiveImporter: Report error on missing file.<commit_after>/*
* This file is part of ATLAS. It is subject to the license terms in
* the LICENSE file found in the top-level directory of this distribution.
* (Also avialable at http://www.apache.org/licenses/LICENSE-2.0.txt)
* You may not use this file except in compliance with the License.
*/

#include <iostream>
#include "ColladaRecursiveImporter.hpp"
#include "../../internal/Exception.hpp"
#include <boost/format.hpp>
#include <Poco/File.h>

namespace AssimpWorker {

	using ATLAS::Model::DataDeletingBlob;
	using ATLAS::Model::Folder;

	ColladaRecursiveImporter::ColladaRecursiveImporter(const Poco::URI& colladaFileURI, Log& log, ColladaMassagerRegistry& registry) :
		Importer(colladaFileURI.toString(), log),
		colladaFileURI(colladaFileURI),
		childImporter(),
		importer(nullptr),
		massagerRegistry(registry),
		massager(nullptr)
	{
		return;
	}

	ColladaRecursiveImporter::ColladaRecursiveImporter(const Poco::URI& colladaFileURI, Log& log, const ColladaRecursiveImporter& parent) :
		Importer(colladaFileURI.toString(), log),
		colladaFileURI(colladaFileURI),
		childImporter(),
		importer(nullptr),
		massagerRegistry(parent.massagerRegistry),
		massager(nullptr)
	{
		return;
	}

	ColladaRecursiveImporter::~ColladaRecursiveImporter(){
		delete importer;
		for (auto ci : childImporter){
			delete ci;
		}
	}

	void ColladaRecursiveImporter::addElementsTo(Folder& root){
		if (!fileExists()) {
			log.error(boost::str(
			              boost::format("Tried to import non-existent file '%1%'. Skipped.")
			              % colladaFileURI.getPath()
		              ));
			return;
		}
		preprocessCollada();
		const aiScene* scene = runAssimpImport();
		convertToFolderStructure(scene, root);
		importChildColladas(root);
	}

	bool ColladaRecursiveImporter::fileExists() const {
		Poco::File colladaFile(colladaFileURI.getPath());
		return colladaFile.exists() && colladaFile.canRead();
	}

{'fraction_non_alphanumeric': 0.11836074413588568, 'fraction_numerical': 0.0013480722566729577, 'mean_word_length': 5.352739726027397, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5218140', 'n_tokens_mistral': 1281, 'n_tokens_neox': 1203, 'n_words': 254}