From ba8ce395cf7ad8a1f0dd4aa88f124e7b37395dd6 Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Sat, 23 Feb 2019 07:11:57 -0600 Subject: Add function to get configured mods directory --- src/organizerproxy.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/organizerproxy.cpp') diff --git a/src/organizerproxy.cpp b/src/organizerproxy.cpp index 8e0bc95b..019904ee 100644 --- a/src/organizerproxy.cpp +++ b/src/organizerproxy.cpp @@ -50,6 +50,11 @@ QString OrganizerProxy::basePath() const return m_Proxied->basePath(); } +QString OrganizerProxy::modsPath() const +{ + return m_Proxied->modsPath(); +} + VersionInfo OrganizerProxy::appVersion() const { return m_Proxied->appVersion(); -- cgit v1.3.1 From b1af3eed10e65b6d39a038d5ccecc687ab94bff2 Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Sun, 24 Mar 2019 21:30:58 -0500 Subject: Add parameters to startApplication to allow control of custom overwrite --- src/organizercore.cpp | 51 +++++++++++++++++++++++++++++++------------------- src/organizercore.h | 2 +- src/organizerproxy.cpp | 8 +++----- src/organizerproxy.h | 3 ++- 4 files changed, 38 insertions(+), 26 deletions(-) (limited to 'src/organizerproxy.cpp') 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& hiddenList, DWORD preferedParentPid); bool onModInstalled(const std::function &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); -- cgit v1.3.1