summaryrefslogtreecommitdiff
path: root/src/configreader.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-10-27 07:03:08 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-10-27 07:03:08 +0000
commit6bc7d2c1ecd6a79545fdf83a9b8b054190d56ed2 (patch)
tree71328d8cf531a1e2e77ff3b89ba052e75bab78df /src/configreader.cpp
parent02e8724bbd180904fd9fdec47ae32e1e45fa37aa (diff)
Allow relative paths for motd and rules (and anything that uses ReadFile)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5546 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/configreader.cpp')
-rw-r--r--src/configreader.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 1059770b4..e0e249963 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -1271,7 +1271,21 @@ bool ServerConfig::ReadFile(file_cache &F, const char* fname)
char linebuf[MAXBUF];
F.clear();
- file = fopen(fname, "r");
+
+ if (*fname != '/')
+ {
+ std::string::size_type pos;
+ std::string confpath = CONFIG_FILE;
+ if((pos = confpath.find("/inspircd.conf")) != std::string::npos)
+ {
+ /* Leaves us with just the path */
+ std::string newfile = confpath.substr(0, pos) + std::string("/") + newfile;
+ file = fopen(newfile.c_str(), "r");
+
+ }
+ }
+ else
+ file = fopen(fname, "r");
if (file)
{