bool AddIOHook(Module* iomod, InspSocket* is);
bool DelIOHook(InspSocket* is);
- static std::string GetFullProgDir(char** argv, int argc);
+ static std::string GetFullProgDir();
static bool DirValid(const char* dirandfile);
static char* CleanFilename(char* name);
static bool FileExists(const char* file);
}
}
-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()
void InspIRCd::OpenLog(char** argv, int argc)
{
- Config->MyDir = ServerConfig::GetFullProgDir(argv,argc);
+ Config->MyDir = ServerConfig::GetFullProgDir();
if (!*this->LogFileName)
{