--- innwebd/innbbsd.cpp 2004/07/02 11:30:28 1.1 +++ innwebd/innbbsd.cpp 2004/07/03 05:52:38 1.2 @@ -45,13 +45,24 @@ int _tmain(int argc, TCHAR* argv[], TCHA return 1; } - // TODO: 在此处为应用程序的行为编写代码。 - // System settings - const char* logfile_file = _T("innbbsd.log"); + const char* conf_file = _T("innbbsd.conf"); + const char* log_file = _T("innbbsd.log"); + + // Get application path + CString app_path; + int pos; + + app_path = argv[0]; + pos = app_path.ReverseFind('\\'); + if (pos != -1) + app_path = app_path.Left(pos + 1); + else + app_path = ""; - syslog.open(logfile_file,ios_base::out | ios_base::app); + syslog.open(app_path + log_file, ios_base::out | ios_base::app); + // Initialize sockets if(!AfxSocketInit()) { syslog << logfile::log_head << "Sockets init failed" << endl; @@ -61,11 +72,7 @@ int _tmain(int argc, TCHAR* argv[], TCHA // Create the service object service innbbsd_srv; - CString conf_file; - conf_file = argv[0]; - conf_file = conf_file.Left(conf_file.ReverseFind('\\')) + "\\innbbsd.conf"; - - innbbsd_srv.ctrld.load_conf(conf_file); + innbbsd_srv.ctrld.load_conf(app_path + conf_file); //Standalone mode if (argc == 2 && _stricmp(argv[1], "-s") == 0)