mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-19 17:09:40 +00:00
set dependencies when saving (requires further refinements)
This commit is contained in:
parent
74d683b530
commit
6d9ff39390
3 changed files with 23 additions and 2 deletions
|
@ -2141,7 +2141,7 @@ void CSMDoc::Document::createBase()
|
|||
|
||||
CSMDoc::Document::Document (const std::vector<boost::filesystem::path>& files,
|
||||
const boost::filesystem::path& savePath, bool new_)
|
||||
: mSavePath (savePath), mTools (mData), mSaving (*this)
|
||||
: mSavePath (savePath), mContentFiles (files), mTools (mData), mSaving (*this)
|
||||
{
|
||||
if (files.empty())
|
||||
throw std::runtime_error ("Empty content file sequence");
|
||||
|
@ -2200,6 +2200,11 @@ const boost::filesystem::path& CSMDoc::Document::getSavePath() const
|
|||
return mSavePath;
|
||||
}
|
||||
|
||||
const std::vector<boost::filesystem::path>& CSMDoc::Document::getContentFiles() const
|
||||
{
|
||||
return mContentFiles;
|
||||
}
|
||||
|
||||
void CSMDoc::Document::save()
|
||||
{
|
||||
if (mSaving.isRunning())
|
||||
|
|
|
@ -33,6 +33,7 @@ namespace CSMDoc
|
|||
private:
|
||||
|
||||
boost::filesystem::path mSavePath;
|
||||
std::vector<boost::filesystem::path> mContentFiles;
|
||||
CSMWorld::Data mData;
|
||||
CSMTools::Tools mTools;
|
||||
Saving mSaving;
|
||||
|
@ -74,6 +75,10 @@ namespace CSMDoc
|
|||
|
||||
const boost::filesystem::path& getSavePath() const;
|
||||
|
||||
const std::vector<boost::filesystem::path>& getContentFiles() const;
|
||||
///< \attention The last element in this collection is the file that is being edited,
|
||||
/// but with its original path instead of the save path.
|
||||
|
||||
void save();
|
||||
|
||||
CSMWorld::UniversalId verify();
|
||||
|
|
|
@ -50,7 +50,18 @@ void CSMDoc::WriteHeaderStage::perform (int stage, std::vector<std::string>& mes
|
|||
mState.getWriter().setDescription ("");
|
||||
mState.getWriter().setRecordCount (0);
|
||||
|
||||
/// \todo fill in dependency list
|
||||
/// \todo refine dependency list (at least remove redundant dependencies)
|
||||
std::vector<boost::filesystem::path> dependencies = mDocument.getContentFiles();
|
||||
std::vector<boost::filesystem::path>::const_iterator end (--dependencies.end());
|
||||
|
||||
for (std::vector<boost::filesystem::path>::const_iterator iter (dependencies.begin());
|
||||
iter!=end; ++iter)
|
||||
{
|
||||
std::string name = iter->filename().string();
|
||||
uint64_t size = boost::filesystem::file_size (*iter);
|
||||
|
||||
mState.getWriter().addMaster (name, size);
|
||||
}
|
||||
|
||||
mState.getWriter().save (mState.getStream());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue