mirror of
https://github.com/OpenMW/openmw.git
synced 2025-11-08 15: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:
parent
e7305e7c97
commit
2ce4571c3a
7 changed files with 5 additions and 17 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue