1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-11-08 14:46:40 +00:00

Handle paths passed on the command line properly

Fixes https://gitlab.com/OpenMW/openmw/-/issues/8567.

Also maybe horribly breaks lots of things because it removes some insanity from https://gitlab.com/OpenMW/openmw/-/merge_requests/86, which would set the CWD to the local directory just in case any local-relative paths were expressed relatively without the explicit base being the local path.
This commit is contained in:
AnyOldName3 2025-06-17 00:24:42 +01:00
parent e7305e7c97
commit 2ce4571c3a
7 changed files with 5 additions and 17 deletions

View file

@ -125,6 +125,7 @@ namespace
}
Files::ConfigurationManager config;
config.processPaths(variables, std::filesystem::current_path());
config.readConfiguration(variables, desc);
Debug::setupLogging(config.getLogPath(), applicationName);

View file

@ -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>();

View file

@ -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);

View file

@ -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");

View file

@ -51,14 +51,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

View file

@ -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

View file

@ -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