summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2019-10-24 02:52:54 -0400
committerisanae <14251494+isanae@users.noreply.github.com>2019-11-06 07:42:57 -0500
commitb60f2aa786cf748e1839f4320604030863279032 (patch)
tree541ce924e085cfad988ec0c9ce444bb92c2e084f /src
parente43500eaf5d40bcd28ba5a820cdbc754cfb47e40 (diff)
renamed startApplication() to runExecutableOrExecutableFile()
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp3
-rw-r--r--src/organizercore.cpp40
-rw-r--r--src/organizercore.h7
-rw-r--r--src/organizerproxy.cpp10
4 files changed, 34 insertions, 26 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 776c3775..49ecc084 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -653,7 +653,8 @@ int runApplication(MOApplication &application, SingleInstance &instance,
arguments.removeFirst(); // remove binary name
// pass the remaining parameters to the binary
try {
- organizer.startApplication(exeName, arguments, QString(), QString());
+ organizer.runExecutableOrExecutableFile(
+ exeName, arguments, QString(), QString());
return 0;
}
catch (const std::exception &e) {
diff --git a/src/organizercore.cpp b/src/organizercore.cpp
index 6f36ee3e..6bf2c290 100644
--- a/src/organizercore.cpp
+++ b/src/organizercore.cpp
@@ -1362,45 +1362,44 @@ HANDLE OrganizerCore::spawnAndWait(
return handle;
}
-HANDLE OrganizerCore::startApplication(const QString &executable,
- const QStringList &args,
- const QString &cwd,
- const QString &profile,
- const QString &forcedCustomOverwrite,
- bool ignoreCustomOverwrite)
+HANDLE OrganizerCore::runExecutableOrExecutableFile(
+ const QString &executable, const QStringList &args, const QString &cwd,
+ const QString &profile, const QString &forcedCustomOverwrite,
+ bool ignoreCustomOverwrite)
{
- QFileInfo binary;
- QString arguments = args.join(" ");
- QString currentDirectory = cwd;
QString profileName = profile;
- if (profile.length() == 0) {
+ if (profile == "") {
if (m_CurrentProfile != nullptr) {
profileName = m_CurrentProfile->name();
} else {
throw MyException(tr("No profile set"));
}
}
+
+ QFileInfo binary;
+ QString arguments = args.join(" ");
+ QString currentDirectory = cwd;
QString steamAppID;
QString customOverwrite;
QList<ExecutableForcedLoadSetting> forcedLibraries;
+
if (executable.contains('\\') || executable.contains('/')) {
// file path
binary = QFileInfo(executable);
if (binary.isRelative()) {
// relative path, should be relative to game directory
- binary = QFileInfo(
- managedGame()->gameDirectory().absoluteFilePath(executable));
+ binary = managedGame()->gameDirectory().absoluteFilePath(executable);
}
- if (cwd.length() == 0) {
+
+ if (currentDirectory == "") {
currentDirectory = binary.absolutePath();
}
+
try {
- const Executable &exe = m_ExecutablesList.getByBinary(binary);
+ const Executable& exe = m_ExecutablesList.getByBinary(binary);
steamAppID = exe.steamAppID();
- customOverwrite
- = m_CurrentProfile->setting("custom_overwrites", exe.title())
- .toString();
+ customOverwrite = m_CurrentProfile->setting("custom_overwrites", exe.title()).toString();
if (m_CurrentProfile->forcedLibrariesEnabled(exe.title())) {
forcedLibraries = m_CurrentProfile->determineForcedLibraries(exe.title());
}
@@ -1412,9 +1411,7 @@ HANDLE OrganizerCore::startApplication(const QString &executable,
try {
const Executable &exe = m_ExecutablesList.get(executable);
steamAppID = exe.steamAppID();
- customOverwrite
- = m_CurrentProfile->setting("custom_overwrites", exe.title())
- .toString();
+ customOverwrite = m_CurrentProfile->setting("custom_overwrites", exe.title()).toString();
if (m_CurrentProfile->forcedLibrariesEnabled(exe.title())) {
forcedLibraries = m_CurrentProfile->determineForcedLibraries(exe.title());
}
@@ -1422,7 +1419,7 @@ HANDLE OrganizerCore::startApplication(const QString &executable,
arguments = exe.arguments();
}
binary = exe.binaryInfo();
- if (cwd.length() == 0) {
+ if (currentDirectory == "") {
currentDirectory = exe.workingDirectory();
}
} catch (const std::runtime_error &) {
@@ -1433,6 +1430,7 @@ HANDLE OrganizerCore::startApplication(const QString &executable,
if (!forcedCustomOverwrite.isEmpty())
customOverwrite = forcedCustomOverwrite;
+
if (ignoreCustomOverwrite)
customOverwrite.clear();
diff --git a/src/organizercore.h b/src/organizercore.h
index ca87a05c..fa05a20f 100644
--- a/src/organizercore.h
+++ b/src/organizercore.h
@@ -174,6 +174,12 @@ public:
bool runShortcut(const MOShortcut& shortcut);
+ HANDLE runExecutableOrExecutableFile(
+ const QString &executable, const QStringList &args, const QString &cwd,
+ const QString &profile, const QString &forcedCustomOverwrite = "",
+ bool ignoreCustomOverwrite = false);
+
+
void loginSuccessfulUpdate(bool necessary);
void loginFailedUpdate(const QString &message);
@@ -227,7 +233,6 @@ public:
DownloadManager *downloadManager();
PluginList *pluginList();
ModList *modList();
- 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 d6996b3a..2ea1761a 100644
--- a/src/organizerproxy.cpp
+++ b/src/organizerproxy.cpp
@@ -107,10 +107,14 @@ QString OrganizerProxy::pluginDataPath() const
return m_Proxied->pluginDataPath();
}
-HANDLE OrganizerProxy::startApplication(const QString &executable, const QStringList &args, const QString &cwd,
- const QString &profile, const QString &forcedCustomOverwrite, bool ignoreCustomOverwrite)
+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, forcedCustomOverwrite, ignoreCustomOverwrite);
+ return m_Proxied->runExecutableOrExecutableFile(
+ executable, args, cwd, profile,
+ forcedCustomOverwrite, ignoreCustomOverwrite);
}
bool OrganizerProxy::waitForApplication(HANDLE handle, LPDWORD exitCode) const