summaryrefslogtreecommitdiff
path: root/src/configreader.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-05-13 17:16:26 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-05-13 17:16:26 +0000
commit9f33bf7fc83cffccae96eb622bf39e8f4838b809 (patch)
tree248bbe5351c3d4eaee4f34589fc38a046204d151 /src/configreader.cpp
parent25a78272bc44ae466ebb2e60e090e07dc1fe4f88 (diff)
Check for windows drive letters on the start of paths and treat them the same as paths that start with /, this makes insp more friendly for windows filesystems
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9724 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/configreader.cpp')
-rw-r--r--src/configreader.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 5b582b713..3f99a52e2 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -1649,6 +1649,11 @@ bool ServerConfig::DoPipe(ConfigDataHash &target, const std::string &file, std::
return ret;
}
+bool ServerConfig::StartsWithWindowsDriveLetter(const std::string &path)
+{
+ return (path.length() > 2 && isalpha(path[0]) && path[1] == ':');
+}
+
bool ServerConfig::DoInclude(ConfigDataHash &target, const std::string &file, std::ostringstream &errorstream)
{
std::string confpath;
@@ -1661,7 +1666,7 @@ bool ServerConfig::DoInclude(ConfigDataHash &target, const std::string &file, st
std::replace(newfile.begin(),newfile.end(),'\\','/');
std::replace(confpath.begin(),confpath.end(),'\\','/');
- if ((newfile[0] != '/') && (newfile.find("://") == std::string::npos))
+ if ((newfile[0] != '/') && (!StartsWithWindowsDriveLetter(newfile)))
{
if((pos = confpath.rfind("/")) != std::string::npos)
{
@@ -1883,7 +1888,7 @@ bool ServerConfig::ReadFile(file_cache &F, const char* fname)
F.clear();
- if ((*fname != '/') && (*fname != '\\'))
+ if ((*fname != '/') && (*fname != '\\') && (!StartsWithWindowsDriveLetter(fname)))
{
std::string::size_type pos;
std::string confpath = ServerInstance->ConfigFileName;