summaryrefslogtreecommitdiff
path: root/src/organizercore.cpp
diff options
context:
space:
mode:
authorTannin <sherb@gmx.net>2015-12-18 20:32:29 +0100
committerTannin <sherb@gmx.net>2015-12-18 20:32:29 +0100
commit502e950cde5920e4184775c47621cb737696f512 (patch)
treed745aa9c184914257db25acb2f62d38ee697f1a2 /src/organizercore.cpp
parent4908affbfceee55d09426b7cab94d155d36d0d90 (diff)
support for adding directories to the vfs that will act as create target for new files
Diffstat (limited to 'src/organizercore.cpp')
-rw-r--r--src/organizercore.cpp18
1 files changed, 13 insertions, 5 deletions
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<Mapping> OrganizerCore::fileMapping()
QCoreApplication::processEvents();
}
+ int overwriteId = m_DirectoryStructure->getOriginByName(L"Overwrite").getID();
+
IPluginGame *game = qApp->property("managed_game").value<IPluginGame *>();
MappingType result = fileMapping(
QDir::toNativeSeparators(game->dataDirectory().absolutePath()),
"\\",
- directoryStructure(), directoryStructure());
+ directoryStructure(), directoryStructure(),
+ overwriteId);
if (m_CurrentProfile->localSavesEnabled()) {
LocalSavegames *localSaves = game->feature<LocalSavegames>();
@@ -1606,7 +1609,8 @@ std::vector<Mapping> OrganizerCore::fileMapping(
const QString &dataPath,
const QString &relPath,
const DirectoryEntry *base,
- const DirectoryEntry *directoryEntry)
+ const DirectoryEntry *directoryEntry,
+ int createDestination)
{
std::vector<Mapping> result;
@@ -1623,7 +1627,7 @@ std::vector<Mapping> 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<Mapping> 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<Mapping> subRes
- = fileMapping(dataPath, relPath + dirName + "\\", base, *current);
+ = fileMapping(dataPath, relPath + dirName + "\\", base, *current,
+ createDestination);
result.insert(result.end(), subRes.begin(), subRes.end());
}
return result;