summaryrefslogtreecommitdiff
path: root/src/processrunner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/processrunner.cpp')
-rw-r--r--src/processrunner.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/processrunner.cpp b/src/processrunner.cpp
index b6167706..46065d69 100644
--- a/src/processrunner.cpp
+++ b/src/processrunner.cpp
@@ -3,6 +3,8 @@
#include "instancemanager.h"
#include "iuserinterface.h"
#include "envmodule.h"
+#include "env.h"
+#include <iplugingame.h>
#include <log.h>
using namespace MOBase;
@@ -473,13 +475,14 @@ ProcessRunner& ProcessRunner::setWaitForCompletion(
return *this;
}
-ProcessRunner& ProcessRunner::setFromFile(QWidget* parent, const QFileInfo& targetInfo)
+ProcessRunner& ProcessRunner::setFromFile(
+ QWidget* parent, const QFileInfo& targetInfo, bool forceHook)
{
if (!parent && m_ui) {
parent = m_ui->qtWidget();
}
- // if the file is a .exe, start it directory; if it's anything else, ask the
+ // if the file is a .exe, start it directly; if it's anything else, ask the
// shell to start it
const auto fec = spawn::getFileExecutionContext(parent, targetInfo);
@@ -497,6 +500,19 @@ ProcessRunner& ProcessRunner::setFromFile(QWidget* parent, const QFileInfo& targ
case spawn::FileExecutionTypes::Other: // fall-through
default:
{
+ if (forceHook) {
+ auto assoc = env::getAssociation(targetInfo);
+ if (!assoc.executable.filePath().isEmpty()) {
+ setBinary(assoc.executable);
+ setArguments(assoc.formattedCommandLine);
+ setCurrentDirectory(assoc.executable.absoluteDir());
+
+ return *this;
+ }
+
+ // if it fails, just use the regular shell open
+ }
+
m_shellOpen = targetInfo.absoluteFilePath();
// picked up by postRun()