0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 16:22:35 +01:00

ircd: Remove fs path relocations for windows.

This commit is contained in:
Jason Volk 2016-08-30 22:59:47 -07:00
parent 153b017358
commit 102c15d768
3 changed files with 0 additions and 88 deletions

View file

@ -84,8 +84,6 @@ namespace path
const char *name(index) noexcept;
};
void init();
} // namespace fs
} // namespace ircd
#endif // __cplusplus

View file

@ -97,87 +97,3 @@ catch(const std::out_of_range &e)
{
return nullptr;
}
#ifdef _WIN32
static
void relocate()
{
using namespace fs::path;
using ircd::inotice;
char prefix[PATH_MAX], workbuf[PATH_MAX];
char *p;
rb_strlcpy(prefix, rb_path_to_self(), sizeof prefix);
paths[IRCD_EXEC] = rb_strdup(prefix);
/* if we're running from inside the source tree, we probably do not want to relocate any other paths */
if (strstr(prefix, ".libs") != NULL)
return;
/* prefix = /home/kaniini/ircd/bin/ircd */
p = strrchr(prefix, RB_PATH_SEPARATOR);
if (rb_unlikely(p == NULL))
return;
*p = 0;
/* prefix = /home/kaniini/ircd/bin */
p = strrchr(prefix, RB_PATH_SEPARATOR);
if (rb_unlikely(p == NULL))
return;
*p = 0;
/* prefix = /home/kaniini/ircd */
paths[PREFIX] = rb_strdup(prefix);
/* now that we have our prefix, we can relocate the other paths... */
snprintf(workbuf, sizeof workbuf, "%s%cmodules", prefix, RB_PATH_SEPARATOR);
paths[MODULES] = rb_strdup(workbuf);
snprintf(workbuf, sizeof workbuf, "%s%cetc", prefix, RB_PATH_SEPARATOR);
paths[ETC] = rb_strdup(workbuf);
snprintf(workbuf, sizeof workbuf, "%s%clog", prefix, RB_PATH_SEPARATOR);
paths[LOG] = rb_strdup(workbuf);
snprintf(workbuf, sizeof workbuf, "%s%chelp%cusers", prefix, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR);
paths[USERHELP] = rb_strdup(workbuf);
snprintf(workbuf, sizeof workbuf, "%s%chelp%copers", prefix, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR);
paths[OPERHELP] = rb_strdup(workbuf);
snprintf(workbuf, sizeof workbuf, "%s%cetc%circd.conf", prefix, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR);
paths[IRCD_CONF] = rb_strdup(workbuf);
snprintf(workbuf, sizeof workbuf, "%s%cetc%circd.motd", prefix, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR);
paths[IRCD_MOTD] = rb_strdup(workbuf);
snprintf(workbuf, sizeof workbuf, "%s%cetc%copers.motd", prefix, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR);
paths[IRCD_OMOTD] = rb_strdup(workbuf);
snprintf(workbuf, sizeof workbuf, "%s%cetc%cban.db", prefix, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR);
paths[BANDB] = rb_strdup(workbuf);
snprintf(workbuf, sizeof workbuf, "%s%clogs%circd.log", prefix, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR);
paths[IRCD_LOG] = rb_strdup(workbuf);
snprintf(workbuf, sizeof workbuf, "%s%cbin", prefix, RB_PATH_SEPARATOR);
paths[BIN] = rb_strdup(workbuf);
paths[LIBEXEC] = rb_strdup(workbuf);
inotice("runtime paths:");
for (size_t i(0); i < paths.size() && i < pathnames.size(); ++i)
inotice(" %s: %s", pathnames[i], paths[i]);
}
#else
static
void relocate()
{
}
#endif
void fs::init()
{
relocate();
}

View file

@ -376,8 +376,6 @@ charybdis_main(int argc, char * const argv[])
}
#endif
fs::init();
logFileName = fs::path::get(fs::path::IRCD_LOG);
ConfigFileEntry.dpath = fs::path::get(fs::path::PREFIX);