aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Sadie Powell2025-02-26 18:55:28 +0000
committerGravatar Sadie Powell2025-02-26 18:57:38 +0000
commit2a087e3cabeac09ed4b00a6de883bd0df468de32 (patch)
treeb1228b787035538f8268c7e9524f778dea74d3aa /src
parentMerge branch 'insp4' into master. (diff)
parentAdd more information to the seenicks message. (diff)
Merge branch 'insp4' into master.
Diffstat (limited to 'src')
-rw-r--r--src/configreader.cpp16
-rw-r--r--src/inspircd.cpp2
2 files changed, 13 insertions, 5 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 5bc94b8a9..07c93d09c 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -73,15 +73,23 @@ std::string ServerConfig::ServerPaths::ExpandPath(const std::string& base, const
if (std::filesystem::path(fragment).is_absolute())
return fragment;
- // The fragment is relative to a home directory, expand that.
if (!fragment.compare(0, 2, "~/", 2))
{
- const char* homedir = getenv("HOME");
+ // The fragment is relative to a home directory, expand that.
+ const auto* homedir = getenv("HOME");
if (homedir && *homedir)
- return std::string(homedir) + '/' + fragment.substr(2);
+ return FMT::format("{}/{}", homedir, fragment.substr(2));
}
- return base + '/' + fragment;
+ if (std::filesystem::path(base).is_relative())
+ {
+ // The base is relative to the working directory, expand that.
+ const auto cwd = std::filesystem::current_path();
+ if (!cwd.empty())
+ return FMT::format("{}/{}/{}", cwd.string(), base, fragment);
+ }
+
+ return FMT::format("{}/{}", base, fragment);
}
ServerConfig::ServerConfig()
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index f87ea439c..e52f47dff 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -255,7 +255,7 @@ namespace
// Parses the command line options.
void ParseOptions()
{
- std::string config;
+ std::string config = ServerInstance->Config->Paths.PrependConfig("inspircd.conf");
bool do_debug = false;
bool do_help = false;
bool do_nofork = false;