diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-05-20 12:54:57 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-05-20 12:54:57 +0000 |
commit | 6ab38d48cad06633bfe5a118c1c5a6877fba6d5a (patch) | |
tree | f70ff58a192db170dbd14527be1c6998f153bb7d /src | |
parent | c3913b1f2fc192184baf5dbdbf12278b10dd1345 (diff) |
- Modify ServerConfig::GetFullProgDir to just return cwd, previously it did a lot of voodoo that was a little hard to grasp, probably didn't quite accomplish what it should have, and broke on windows.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7063 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/configreader.cpp | 32 | ||||
-rw-r--r-- | src/helperfuncs.cpp | 2 |
2 files changed, 7 insertions, 27 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp index 4d4dccb08..8e785a1e4 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -1593,42 +1593,22 @@ bool ServerConfig::DirValid(const char* dirandfile) } } -std::string ServerConfig::GetFullProgDir(char** argv, int argc) +std::string ServerConfig::GetFullProgDir() { - char work[1024]; char buffer[1024]; - char otherdir[1024]; - int p; - - strlcpy(work,argv[0],1024); - p = strlen(work); - - // we just want the dir - while (*work) - { - if ((work[p] == '/') || (work[p] == '\\')) - { - work[p] = '\0'; - break; - } - - work[p--] = '\0'; - } // Get the current working directory if (getcwd(buffer, 1024) == NULL) + { return ""; - - if (chdir(work) == -1) - return ""; - - if (getcwd(otherdir, 1024) == NULL) - return ""; + } if (chdir(buffer) == -1) + { return ""; + } - return otherdir; + return buffer; } InspIRCd* ServerConfig::GetInstance() diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index d79b18c9d..03d6879ba 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -431,7 +431,7 @@ bool InspIRCd::IsIdent(const char* n) void InspIRCd::OpenLog(char** argv, int argc) { - Config->MyDir = ServerConfig::GetFullProgDir(argv,argc); + Config->MyDir = ServerConfig::GetFullProgDir(); if (!*this->LogFileName) { |