summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLostDragonist <lost.dragonist@gmail.com>2019-03-24 21:30:58 -0500
committerLostDragonist <lost.dragonist@gmail.com>2019-03-24 21:30:58 -0500
commitb1af3eed10e65b6d39a038d5ccecc687ab94bff2 (patch)
tree5a37e626b678289e349c6ae47c56517c8a2cf0a8 /src
parenta4679b6fac49cedaa834f31f47416a78f79f6be0 (diff)
Add parameters to startApplication to allow control of custom overwrite
Diffstat (limited to 'src')
-rw-r--r--src/organizercore.cpp51
-rw-r--r--src/organizercore.h2
-rw-r--r--src/organizerproxy.cpp8
-rw-r--r--src/organizerproxy.h3
4 files changed, 38 insertions, 26 deletions
diff --git a/src/organizercore.cpp b/src/organizercore.cpp
index 9c883eb7..687fd6c9 100644
--- a/src/organizercore.cpp
+++ b/src/organizercore.cpp
@@ -110,22 +110,22 @@ static bool renameFile(const QString &oldName, const QString &newName,
static std::wstring getProcessName(HANDLE process)
{
- wchar_t buffer[MAX_PATH];
- wchar_t *fileName = L"unknown";
+ wchar_t buffer[MAX_PATH];
+ wchar_t *fileName = L"unknown";
- if (process == nullptr) return fileName;
+ if (process == nullptr) return fileName;
- if (::GetProcessImageFileNameW(process, buffer, MAX_PATH) != 0) {
- fileName = wcsrchr(buffer, L'\\');
- if (fileName == nullptr) {
- fileName = buffer;
- }
- else {
- fileName += 1;
- }
- }
+ if (::GetProcessImageFileNameW(process, buffer, MAX_PATH) != 0) {
+ fileName = wcsrchr(buffer, L'\\');
+ if (fileName == nullptr) {
+ fileName = buffer;
+ }
+ else {
+ fileName += 1;
+ }
+ }
- return fileName;
+ return fileName;
}
// Get parent PID for the given process, return 0 on failure
@@ -677,8 +677,8 @@ void OrganizerCore::downloadRequestedNXM(const QString &url)
void OrganizerCore::externalMessage(const QString &message)
{
if (MOShortcut moshortcut{ message } ) {
- if(moshortcut.hasExecutable())
- runShortcut(moshortcut);
+ if(moshortcut.hasExecutable())
+ runShortcut(moshortcut);
}
else if (isNxmLink(message)) {
MessageDialog::showMessage(tr("Download started"), qApp->activeWindow());
@@ -1517,7 +1517,9 @@ HANDLE OrganizerCore::runShortcut(const MOShortcut& shortcut)
HANDLE OrganizerCore::startApplication(const QString &executable,
const QStringList &args,
const QString &cwd,
- const QString &profile)
+ const QString &profile,
+ const QString &forcedCustomOverwrite,
+ bool ignoreCustomOverwrite)
{
QFileInfo binary;
QString arguments = args.join(" ");
@@ -1582,7 +1584,18 @@ HANDLE OrganizerCore::startApplication(const QString &executable,
}
}
- return spawnBinaryDirect(binary, arguments, profileName, currentDirectory, steamAppID, customOverwrite, forcedLibraries);
+ if (!forcedCustomOverwrite.isEmpty())
+ customOverwrite = forcedCustomOverwrite;
+ if (ignoreCustomOverwrite)
+ customOverwrite.clear();
+
+ return spawnBinaryDirect(binary,
+ arguments,
+ profileName,
+ currentDirectory,
+ steamAppID,
+ customOverwrite,
+ forcedLibraries);
}
bool OrganizerCore::waitForApplication(HANDLE handle, LPDWORD exitCode)
@@ -2222,8 +2235,8 @@ void OrganizerCore::loginSuccessful(bool necessary)
task();
}
- m_PostLoginTasks.clear();
- NexusInterface::instance(m_PluginContainer)->loginCompleted();
+ m_PostLoginTasks.clear();
+ NexusInterface::instance(m_PluginContainer)->loginCompleted();
}
void OrganizerCore::loginSuccessfulUpdate(bool necessary)
diff --git a/src/organizercore.h b/src/organizercore.h
index 2a31d00a..bfb72529 100644
--- a/src/organizercore.h
+++ b/src/organizercore.h
@@ -209,7 +209,7 @@ public:
PluginList *pluginList();
ModList *modList();
HANDLE runShortcut(const MOShortcut& shortcut);
- HANDLE startApplication(const QString &executable, const QStringList &args, const QString &cwd, const QString &profile);
+ HANDLE startApplication(const QString &executable, const QStringList &args, const QString &cwd, const QString &profile, const QString &forcedCustomOverwrite = "", bool ignoreCustomOverwrite = false);
bool waitForApplication(HANDLE processHandle, LPDWORD exitCode = nullptr);
HANDLE findAndOpenAUSVFSProcess(const std::vector<QString>& hiddenList, DWORD preferedParentPid);
bool onModInstalled(const std::function<void (const QString &)> &func);
diff --git a/src/organizerproxy.cpp b/src/organizerproxy.cpp
index 019904ee..d6996b3a 100644
--- a/src/organizerproxy.cpp
+++ b/src/organizerproxy.cpp
@@ -39,9 +39,6 @@ QString OrganizerProxy::downloadsPath() const
QString OrganizerProxy::overwritePath() const
{
- /*return QDir::fromNativeSeparators(qApp->property("dataPath").toString())
- + "/"
- + ToQString(AppConfig::overwritePath());*/
return m_Proxied->overwritePath();
}
@@ -110,9 +107,10 @@ QString OrganizerProxy::pluginDataPath() const
return m_Proxied->pluginDataPath();
}
-HANDLE OrganizerProxy::startApplication(const QString &executable, const QStringList &args, const QString &cwd, const QString &profile)
+HANDLE OrganizerProxy::startApplication(const QString &executable, const QStringList &args, const QString &cwd,
+ const QString &profile, const QString &forcedCustomOverwrite, bool ignoreCustomOverwrite)
{
- return m_Proxied->startApplication(executable, args, cwd, profile);
+ return m_Proxied->startApplication(executable, args, cwd, profile, forcedCustomOverwrite, ignoreCustomOverwrite);
}
bool OrganizerProxy::waitForApplication(HANDLE handle, LPDWORD exitCode) const
diff --git a/src/organizerproxy.h b/src/organizerproxy.h
index b8a4ea50..c8a96ed3 100644
--- a/src/organizerproxy.h
+++ b/src/organizerproxy.h
@@ -43,7 +43,8 @@ public:
virtual MOBase::IPluginList *pluginList() const;
virtual MOBase::IModList *modList() const;
virtual MOBase::IProfile *profile() const override;
- virtual HANDLE startApplication(const QString &executable, const QStringList &args = QStringList(), const QString &cwd = "", const QString &profile = "");
+ virtual HANDLE startApplication(const QString &executable, const QStringList &args = QStringList(), const QString &cwd = "",
+ const QString &profile = "", const QString &forcedCustomOverwrite = "", bool ignoreCustomOverwrite = false);
virtual bool waitForApplication(HANDLE handle, LPDWORD exitCode = nullptr) const;
virtual void refreshModList(bool saveChanges);