diff options
| author | Tannin <sherb@gmx.net> | 2015-12-18 20:32:29 +0100 |
|---|---|---|
| committer | Tannin <sherb@gmx.net> | 2015-12-18 20:32:29 +0100 |
| commit | 502e950cde5920e4184775c47621cb737696f512 (patch) | |
| tree | d745aa9c184914257db25acb2f62d38ee697f1a2 | |
| parent | 4908affbfceee55d09426b7cab94d155d36d0d90 (diff) | |
support for adding directories to the vfs that will act as create target for new files
| -rw-r--r-- | src/organizercore.cpp | 18 | ||||
| -rw-r--r-- | src/organizercore.h | 5 | ||||
| -rw-r--r-- | src/usvfsconnector.cpp | 2 |
3 files changed, 17 insertions, 8 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;
diff --git a/src/organizercore.h b/src/organizercore.h index 86994f6d..ff730c2b 100644 --- a/src/organizercore.h +++ b/src/organizercore.h @@ -116,7 +116,7 @@ public: void doAfterLogin(const std::function<void()> &function) { m_PostLoginTasks.append(function); }
- void spawnBinary(const QFileInfo &binary, const QString &arguments = "", const QDir ¤tDirectory = QDir(), bool closeAfterStart = true, const QString &steamAppID = "");
+ void spawnBinary(const QFileInfo &binary, const QString &arguments = "", const QDir ¤tDirectory = QDir(), const QString &steamAppID = "");
HANDLE spawnBinaryDirect(const QFileInfo &binary, const QString &arguments, const QString &profileName, const QDir ¤tDirectory, const QString &steamAppID);
void loginSuccessfulUpdate(bool necessary);
@@ -218,7 +218,8 @@ private: std::vector<Mapping>
fileMapping(const QString &dataPath, const QString &relPath,
const MOShared::DirectoryEntry *base,
- const MOShared::DirectoryEntry *directoryEntry);
+ const MOShared::DirectoryEntry *directoryEntry,
+ int createDestination);
private slots:
diff --git a/src/usvfsconnector.cpp b/src/usvfsconnector.cpp index f3a45dfe..380abe01 100644 --- a/src/usvfsconnector.cpp +++ b/src/usvfsconnector.cpp @@ -133,7 +133,7 @@ void UsvfsConnector::updateMapping(const MappingType &mapping) if (map.isDirectory) { VirtualLinkDirectoryStatic(map.source.toStdWString().c_str() , map.destination.toStdWString().c_str() - , 0); + , (map.createTarget ? LINKFLAG_CREATETARGET : 0) | LINKFLAG_RECURSIVE); } else { VirtualLinkFile(map.source.toStdWString().c_str() , map.destination.toStdWString().c_str() |
