diff options
author | Sadie Powell <sadie@witchery.services> | 2024-03-19 15:10:25 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2024-03-19 15:11:40 +0000 |
commit | fde3438ef29447f41a6eb48049f8d620c1c2eb30 (patch) | |
tree | fcd2f03a9d5b693106ab545d3ffd08934149aee2 /include | |
parent | 1575dea5b96e7249d94ebc9214a73d123919c4ba (diff) |
Allow using absolute paths in more places.
Diffstat (limited to 'include')
-rw-r--r-- | include/anope.h | 22 |
1 files changed, 22 insertions, 0 deletions
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. |