mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-29 01:11:34 +00:00
Merge branch 'path-delousing' into 'master'
Handle paths passed on the command line properly Closes #8567 See merge request OpenMW/openmw!4721
This commit is contained in:
commit
8367604331
10 changed files with 20 additions and 40 deletions
|
@ -236,6 +236,7 @@
|
|||
Bug #8465: Blue screen w/ antialiasing and post-processing on macOS
|
||||
Bug #8503: Camera does not handle NaN gracefully
|
||||
Bug #8541: Lua: util.color:asHex produces wrong output for some colors
|
||||
Bug #8567: Token replacement does not work via CLI and relative paths passed via the command line are not relative to the CWD
|
||||
Feature #1415: Infinite fall failsafe
|
||||
Feature #2566: Handle NAM9 records for manual cell references
|
||||
Feature #3501: OpenMW-CS: Instance Editing - Shortcuts for axial locking
|
||||
|
|
|
@ -125,6 +125,7 @@ namespace
|
|||
}
|
||||
|
||||
Files::ConfigurationManager config;
|
||||
config.processPaths(variables, std::filesystem::current_path());
|
||||
config.readConfiguration(variables, desc);
|
||||
|
||||
Debug::setupLogging(config.getLogPath(), applicationName);
|
||||
|
|
|
@ -40,6 +40,7 @@ Allowed options)");
|
|||
bpo::notify(variables);
|
||||
|
||||
Files::ConfigurationManager cfgManager(true);
|
||||
cfgManager.processPaths(variables, std::filesystem::current_path());
|
||||
cfgManager.readConfiguration(variables, desc);
|
||||
|
||||
const auto& essFile = variables["mwsave"].as<Files::MaybeQuotedPath>();
|
||||
|
|
|
@ -143,6 +143,7 @@ namespace NavMeshTool
|
|||
}
|
||||
|
||||
Files::ConfigurationManager config;
|
||||
config.processPaths(variables, std::filesystem::current_path());
|
||||
config.readConfiguration(variables, desc);
|
||||
|
||||
Debug::setupLogging(config.getLogPath(), applicationName);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -61,6 +61,8 @@ bool parseOptions(int argc, char** argv, OMW::Engine& engine, Files::Configurati
|
|||
return false;
|
||||
}
|
||||
|
||||
cfgMgr.processPaths(variables, std::filesystem::current_path());
|
||||
|
||||
cfgMgr.readConfiguration(variables, desc);
|
||||
|
||||
Debug::setupLogging(cfgMgr.getLogPath(), "OpenMW");
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include <pwd.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <components/debug/debuglog.hpp>
|
||||
#include <components/misc/strings/lower.hpp>
|
||||
|
||||
namespace
|
||||
|
@ -51,14 +50,6 @@ namespace Files
|
|||
LinuxPath::LinuxPath(const std::string& application_name)
|
||||
: mName(application_name)
|
||||
{
|
||||
std::error_code ec;
|
||||
current_path(getLocalPath(), ec);
|
||||
const auto err = ec.value();
|
||||
if (err != 0)
|
||||
{
|
||||
Log(Debug::Warning) << "Error " << err << " " << std::generic_category().message(errno)
|
||||
<< " when changing current directory";
|
||||
}
|
||||
}
|
||||
|
||||
std::filesystem::path LinuxPath::getUserConfigPath() const
|
||||
|
|
|
@ -64,11 +64,6 @@ namespace Files
|
|||
MacOsPath::MacOsPath(const std::string& application_name)
|
||||
: mName(application_name)
|
||||
{
|
||||
std::filesystem::path binary_path = getBinaryPath();
|
||||
std::error_code ec;
|
||||
std::filesystem::current_path(binary_path.parent_path(), ec);
|
||||
if (ec.value() != 0)
|
||||
Log(Debug::Warning) << "Error " << ec.message() << " when changing current directory";
|
||||
}
|
||||
|
||||
std::filesystem::path MacOsPath::getUserConfigPath() const
|
||||
|
@ -102,7 +97,7 @@ namespace Files
|
|||
|
||||
std::filesystem::path MacOsPath::getLocalPath() const
|
||||
{
|
||||
return std::filesystem::path("../Resources/");
|
||||
return getBinaryPath().parent_path().parent_path() / "Resources";
|
||||
}
|
||||
|
||||
std::filesystem::path MacOsPath::getGlobalDataPath() const
|
||||
|
|
|
@ -26,10 +26,6 @@ namespace Files
|
|||
WindowsPath::WindowsPath(const std::string& application_name)
|
||||
: mName(application_name)
|
||||
{
|
||||
std::error_code ec;
|
||||
current_path(getLocalPath(), ec);
|
||||
if (ec.value() != 0)
|
||||
Log(Debug::Warning) << "Error " << ec.value() << " when changing current directory";
|
||||
}
|
||||
|
||||
std::filesystem::path WindowsPath::getUserConfigPath() const
|
||||
|
|
|
@ -1,14 +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 +57,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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue