1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-10-15 07:56:37 +00:00

Fix launching other binaries when the CWD is not the binary directory

This commit is contained in:
AnyOldName3 2025-06-19 00:19:14 +01:00
parent 2ce4571c3a
commit acbc0a9b8f
2 changed files with 13 additions and 20 deletions

View file

@ -2,11 +2,8 @@
#include <utility>
#if defined(Q_OS_MAC)
#include <QCoreApplication>
#include <QDir>
#endif
#include <QProcess>
#include <QString>
#include <QStringList>
@ -55,16 +52,17 @@ void CSMDoc::Runner::start(bool delayed)
QString path = "openmw";
#ifdef Q_OS_WIN
path.append(QString(".exe"));
#elif defined(Q_OS_MAC)
QDir dir(QCoreApplication::applicationDirPath());
dir.cdUp();
dir.cdUp();
dir.cdUp();
path = dir.absoluteFilePath(path.prepend("OpenMW.app/Contents/MacOS/"));
#else
path.prepend(QString("./"));
path.append(QLatin1String(".exe"));
#endif
QDir dir(QCoreApplication::applicationDirPath());
#ifdef Q_OS_MAC
// the CS and engine are in separate .app directories
dir.cdUp();
dir.cdUp();
dir.cdUp();
path.prepend("OpenMW.app/Contents/MacOS/")
#endif
path = dir.absoluteFilePath(path);
mStartup = new QTemporaryFile(this);
mStartup->open();

View file

@ -1,13 +1,11 @@
#include "processinvoker.hpp"
#include <QCoreApplication>
#include <QDir>
#include <QMessageBox>
#include <QString>
#include <QStringList>
#if defined(Q_OS_MAC)
#include <QCoreApplication>
#endif
Process::ProcessInvoker::ProcessInvoker(QObject* parent)
: QObject(parent)
@ -60,12 +58,9 @@ bool Process::ProcessInvoker::startProcess(const QString& name, const QStringLis
QString path(name);
#ifdef Q_OS_WIN
path.append(QLatin1String(".exe"));
#elif defined(Q_OS_MAC)
QDir dir(QCoreApplication::applicationDirPath());
path = dir.absoluteFilePath(name);
#else
path.prepend(QLatin1String("./"));
#endif
QDir dir(QCoreApplication::applicationDirPath());
path = dir.absoluteFilePath(path);
QFileInfo info(path);