|
|
|
@ -3,8 +3,11 @@
|
|
|
|
|
|
|
|
|
|
#include "mergestate.hpp"
|
|
|
|
|
|
|
|
|
|
CSMTools::FinishMergedDocumentStage::FinishMergedDocumentStage (MergeState& state)
|
|
|
|
|
: mState (state)
|
|
|
|
|
#include "../doc/document.hpp"
|
|
|
|
|
#include "../world/data.hpp"
|
|
|
|
|
|
|
|
|
|
CSMTools::FinishMergedDocumentStage::FinishMergedDocumentStage (MergeState& state, ToUTF8::FromType encoding)
|
|
|
|
|
: mState (state), mEncoder (encoding)
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
int CSMTools::FinishMergedDocumentStage::setup()
|
|
|
|
@ -14,5 +17,25 @@ int CSMTools::FinishMergedDocumentStage::setup()
|
|
|
|
|
|
|
|
|
|
void CSMTools::FinishMergedDocumentStage::perform (int stage, CSMDoc::Messages& messages)
|
|
|
|
|
{
|
|
|
|
|
// We know that the content file list contains at least two entries and that the first one
|
|
|
|
|
// does exist on disc (otherwise it would have been impossible to initiate a merge on that
|
|
|
|
|
// document).
|
|
|
|
|
boost::filesystem::path path = mState.mSource.getContentFiles()[0];
|
|
|
|
|
|
|
|
|
|
ESM::ESMReader reader;
|
|
|
|
|
reader.setEncoder (&mEncoder);
|
|
|
|
|
reader.open (path.string());
|
|
|
|
|
|
|
|
|
|
CSMWorld::MetaData source;
|
|
|
|
|
source.mId = "sys::meta";
|
|
|
|
|
source.load (reader);
|
|
|
|
|
|
|
|
|
|
CSMWorld::MetaData target = mState.mTarget->getData().getMetaData();
|
|
|
|
|
|
|
|
|
|
target.mAuthor = source.mAuthor;
|
|
|
|
|
target.mDescription = source.mDescription;
|
|
|
|
|
|
|
|
|
|
mState.mTarget->getData().setMetaData (target);
|
|
|
|
|
|
|
|
|
|
mState.mCompleted = true;
|
|
|
|
|
}
|
|
|
|
|