mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-09 10:39:02 -04:00
parent
ec57c7545d
commit
6c2100a2e4
@ -237,7 +237,7 @@ public:
|
|||||||
XLineManager* XLines = nullptr;
|
XLineManager* XLines = nullptr;
|
||||||
|
|
||||||
/** The current server configuration file from --config or configure. */
|
/** The current server configuration file from --config or configure. */
|
||||||
std::string ConfigFileName = INSPIRCD_CONFIG_PATH "/inspircd.conf";
|
std::string ConfigFileName;
|
||||||
|
|
||||||
/** Fills a buffer with random bytes. */
|
/** Fills a buffer with random bytes. */
|
||||||
std::function<void(char*, size_t)> GenRandom = &DefaultGenRandom;
|
std::function<void(char*, size_t)> GenRandom = &DefaultGenRandom;
|
||||||
|
@ -71,14 +71,22 @@ std::string ServerConfig::ServerPaths::ExpandPath(const std::string& base, const
|
|||||||
if (std::filesystem::path(fragment).is_absolute())
|
if (std::filesystem::path(fragment).is_absolute())
|
||||||
return fragment;
|
return fragment;
|
||||||
|
|
||||||
// The fragment is relative to a home directory, expand that.
|
|
||||||
if (!fragment.compare(0, 2, "~/", 2))
|
if (!fragment.compare(0, 2, "~/", 2))
|
||||||
{
|
{
|
||||||
|
// The fragment is relative to a home directory, expand that.
|
||||||
const char* homedir = getenv("HOME");
|
const char* homedir = getenv("HOME");
|
||||||
if (homedir && *homedir)
|
if (homedir && *homedir)
|
||||||
return std::string(homedir) + '/' + fragment.substr(2);
|
return std::string(homedir) + '/' + fragment.substr(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 INSP_FORMAT("{}/{}/{}", cwd.string(), base, fragment);
|
||||||
|
}
|
||||||
|
|
||||||
return base + '/' + fragment;
|
return base + '/' + fragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ namespace
|
|||||||
// Parses the command line options.
|
// Parses the command line options.
|
||||||
void ParseOptions()
|
void ParseOptions()
|
||||||
{
|
{
|
||||||
std::string config;
|
std::string config = ServerInstance->Config->Paths.PrependConfig("inspircd.conf");
|
||||||
bool do_debug = false;
|
bool do_debug = false;
|
||||||
bool do_help = false;
|
bool do_help = false;
|
||||||
bool do_nofork = false;
|
bool do_nofork = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user