fix correct folder naming scheme.

pull/1618/head
Kim Kulling 2017-12-06 22:15:34 +01:00
parent 95e9cd75fa
commit c23c63e821
2 changed files with 19 additions and 5 deletions

View File

@ -191,7 +191,7 @@ bool D3MFExporter::export3DModel() {
info->type = XmlTag::PACKAGE_START_PART_RELATIONSHIP_TYPE; info->type = XmlTag::PACKAGE_START_PART_RELATIONSHIP_TYPE;
mRelations.push_back( info ); mRelations.push_back( info );
writeModelToArchive( "/3D", "3DModel.model" ); writeModelToArchive( "3D", "3DModel.model" );
mModelOutput.flush(); mModelOutput.flush();
return true; return true;

View File

@ -413,14 +413,22 @@ public:
// empty // empty
} }
bool validateRels( OpcPackageRelationshipPtr &relPtr ) {
if ( relPtr->id.empty() || relPtr->type.empty() || relPtr->target.empty() ) {
return false;
}
return true;
}
void ParseChildNode(XmlReader* xmlReader) { void ParseChildNode(XmlReader* xmlReader) {
OpcPackageRelationshipPtr relPtr(new OpcPackageRelationship()); OpcPackageRelationshipPtr relPtr(new OpcPackageRelationship());
relPtr->id = xmlReader->getAttributeValueSafe(XmlTag::RELS_ATTRIB_ID.c_str()); relPtr->id = xmlReader->getAttributeValueSafe(XmlTag::RELS_ATTRIB_ID.c_str());
relPtr->type = xmlReader->getAttributeValueSafe(XmlTag::RELS_ATTRIB_TYPE.c_str()); relPtr->type = xmlReader->getAttributeValueSafe(XmlTag::RELS_ATTRIB_TYPE.c_str());
relPtr->target = xmlReader->getAttributeValueSafe(XmlTag::RELS_ATTRIB_TARGET.c_str()); relPtr->target = xmlReader->getAttributeValueSafe(XmlTag::RELS_ATTRIB_TARGET.c_str());
if ( validateRels( relPtr ) ) {
m_relationShips.push_back(relPtr); m_relationShips.push_back( relPtr );
}
} }
std::vector<OpcPackageRelationshipPtr> m_relationShips; std::vector<OpcPackageRelationshipPtr> m_relationShips;
@ -450,13 +458,19 @@ D3MFOpcPackage::D3MFOpcPackage(IOSystem* pIOHandler, const std::string& rFile)
std::string rootFile = ReadPackageRootRelationship(fileStream); std::string rootFile = ReadPackageRootRelationship(fileStream);
if ( rootFile.size() > 0 && rootFile[ 0 ] == '/' ) { if ( rootFile.size() > 0 && rootFile[ 0 ] == '/' ) {
rootFile = rootFile.substr( 1 ); rootFile = rootFile.substr( 1 );
if ( rootFile[ 0 ] == '/' ) {
// deal with zipbug
rootFile = rootFile.substr( 1 );
}
} }
DefaultLogger::get()->debug(rootFile); DefaultLogger::get()->debug(rootFile);
mRootStream = mZipArchive->Open(rootFile.c_str()); mRootStream = mZipArchive->Open(rootFile.c_str());
ai_assert( mRootStream != nullptr );
ai_assert(mRootStream != nullptr); if ( nullptr == mRootStream ) {
throw DeadlyExportError( "Cannot open rootfile in archive : " + rootFile );
}
// const size_t size = zipArchive->FileSize(); // const size_t size = zipArchive->FileSize();
// m_Data.resize( size ); // m_Data.resize( size );