From fde3438ef29447f41a6eb48049f8d620c1c2eb30 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 19 Mar 2024 15:10:25 +0000 Subject: Allow using absolute paths in more places. --- include/anope.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'include') diff --git a/include/anope.h b/include/anope.h index 91d073133..e1505652a 100644 --- a/include/anope.h +++ b/include/anope.h @@ -579,6 +579,28 @@ namespace Anope /** Update the current time. */ extern CoreExport void UpdateTime(); + + /** Expands a path fragment that is relative to the base directory. + * @param base The base directory that it is relative to. + * @param fragment The fragment to expand. + */ + extern CoreExport Anope::string Expand(const Anope::string &base, const Anope::string &fragment); + + /** Expands a config path. */ + inline auto ExpandConfig(const Anope::string &path) { return Expand(ConfigDir, path); } + + /** Expands a data path. */ + inline auto ExpandData(const Anope::string &path) { return Expand(DataDir, path); } + + /** Expands a locale path. */ + inline auto ExpandLocale(const Anope::string &path) { return Expand(LocaleDir, path); } + + /** Expands a log path. */ + inline auto ExpandLog(const Anope::string &path) { return Expand(LogDir, path); } + + /** Expands a module path. */ + inline auto ExpandModule(const Anope::string &path) { return Expand(ModuleDir, path); } + } /** sepstream allows for splitting token separated lists. -- cgit