From 502e950cde5920e4184775c47621cb737696f512 Mon Sep 17 00:00:00 2001 From: Tannin Date: Fri, 18 Dec 2015 20:32:29 +0100 Subject: support for adding directories to the vfs that will act as create target for new files --- src/organizercore.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/organizercore.cpp') diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 59a58e48..6a8e148f 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -1574,11 +1574,14 @@ std::vector OrganizerCore::fileMapping() QCoreApplication::processEvents(); } + int overwriteId = m_DirectoryStructure->getOriginByName(L"Overwrite").getID(); + IPluginGame *game = qApp->property("managed_game").value(); MappingType result = fileMapping( QDir::toNativeSeparators(game->dataDirectory().absolutePath()), "\\", - directoryStructure(), directoryStructure()); + directoryStructure(), directoryStructure(), + overwriteId); if (m_CurrentProfile->localSavesEnabled()) { LocalSavegames *localSaves = game->feature(); @@ -1606,7 +1609,8 @@ std::vector OrganizerCore::fileMapping( const QString &dataPath, const QString &relPath, const DirectoryEntry *base, - const DirectoryEntry *directoryEntry) + const DirectoryEntry *directoryEntry, + int createDestination) { std::vector result; @@ -1623,7 +1627,7 @@ std::vector OrganizerCore::fileMapping( QString source = originPath + relPath + fileName; QString target = dataPath + relPath + fileName; if (source != target) { - result.push_back({source, target, false}); + result.push_back({source, target, false, false}); } } @@ -1639,9 +1643,13 @@ std::vector OrganizerCore::fileMapping( QString source = originPath + relPath + dirName; QString target = dataPath + relPath + dirName; - result.push_back({source, target, true}); + bool writeDestination = (base == directoryEntry) + && (origin == createDestination); + + result.push_back({source, target, true, writeDestination}); std::vector subRes - = fileMapping(dataPath, relPath + dirName + "\\", base, *current); + = fileMapping(dataPath, relPath + dirName + "\\", base, *current, + createDestination); result.insert(result.end(), subRes.begin(), subRes.end()); } return result; -- cgit v1.3.1