0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-02-16 16:50:12 +01:00

ircd::fs: Path cleanup.

This commit is contained in:
Jason Volk 2017-11-26 12:56:08 -07:00
parent 9df74c910c
commit ea26fd0016
2 changed files with 16 additions and 34 deletions

View file

@ -50,18 +50,12 @@ namespace ircd::fs
constexpr auto DPATH = IRCD_PREFIX;
constexpr auto BINPATH = IRCD_PREFIX "/bin";
constexpr auto MODPATH = RB_MODULE_DIR;
constexpr auto ETCPATH = RB_ETC_DIR;
constexpr auto LOGPATH = RB_LOG_DIR;
constexpr auto UHPATH = RB_HELP_DIR "/users";
constexpr auto HPATH = RB_HELP_DIR "/opers";
constexpr auto SPATH = RB_BIN_DIR "/" BRANDING_NAME; // ircd executable
constexpr auto MODPATH = RB_MODULE_DIR;
constexpr auto CPATH = RB_ETC_DIR "/ircd.conf"; // ircd.conf file
constexpr auto MPATH = RB_ETC_DIR "/ircd.motd"; // MOTD file
constexpr auto LPATH = RB_LOG_DIR "/ircd.log"; // ircd logfile
constexpr auto OPATH = RB_ETC_DIR "/opers.motd"; // oper MOTD file
constexpr auto SPATH = RB_BIN_DIR "/" BRANDING_NAME; // ircd executable
constexpr auto DBPATH = PKGLOCALSTATEDIR "/db"; // database prefix
constexpr auto BDBPATH = PKGLOCALSTATEDIR "/ban.db"; // bandb file
// Below are the elements for default paths.
enum index
@ -72,15 +66,10 @@ namespace ircd::fs
LOG,
LIBEXEC,
MODULES,
USERHELP,
OPERHELP,
IRCD_CONF,
IRCD_EXEC,
IRCD_MOTD,
IRCD_LOG,
IRCD_OMOTD,
BANDB,
DB,
_NUM_
};

View file

@ -26,20 +26,22 @@
#include <boost/filesystem.hpp>
#include <ircd/asio.h>
namespace ircd {
namespace fs {
using namespace boost::filesystem;
enum
namespace ircd::fs
{
NAME = 0,
PATH = 1,
};
using namespace boost::filesystem;
using ent = std::pair<std::string, std::string>;
enum
{
NAME = 0,
PATH = 1,
};
std::array<ent, num_of<index>()> paths
using ent = std::pair<std::string, std::string>;
extern const std::array<ent, num_of<index>()> paths;
}
decltype(ircd::fs::paths)
ircd::fs::paths
{{
{ "prefix", DPATH },
{ "binary dir", BINPATH },
@ -47,20 +49,11 @@ std::array<ent, num_of<index>()> paths
{ "log", LOGPATH },
{ "libexec dir", PKGLIBEXECDIR },
{ "modules", MODPATH },
{ "user help", UHPATH },
{ "oper help", HPATH },
{ "ircd.conf", CPATH },
{ "ircd binary", SPATH },
{ "ircd.motd", MPATH },
{ "ircd.log", LPATH },
{ "oper motd", OPATH },
{ "bandb", BDBPATH },
{ "db", DBPATH },
}};
} // namespace fs
} // namespace ircd
bool
ircd::fs::write(const std::string &path,
const const_raw_buffer &buf)