diff options
author | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2011-12-04 02:01:11 +0200 |
---|---|---|
committer | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2011-12-04 02:01:11 +0200 |
commit | d1a97e27e880a8b052cba50536d5c41123b4c8df (patch) | |
tree | 4ad9bc2635ccd03733e8db67180e73a683903e77 /server | |
parent | 5c789cf06a29cbe9ce628b550b9cd7c93552cf26 (diff) |
fixed path's
Diffstat (limited to 'server')
-rw-r--r-- | server/server/config.h | 2 | ||||
-rw-r--r-- | server/server/log.cpp | 10 | ||||
-rw-r--r-- | server/server/log.h | 3 | ||||
-rw-r--r-- | server/server/main.cpp | 17 |
4 files changed, 21 insertions, 11 deletions
diff --git a/server/server/config.h b/server/server/config.h index d411411..5da2b80 100644 --- a/server/server/config.h +++ b/server/server/config.h @@ -99,7 +99,7 @@ public: timeout = t; } }; - config(const char *path); + config(const char *path = NULL); const int ban_time(); const int conn_count(); const int conn_time(); diff --git a/server/server/log.cpp b/server/server/log.cpp index 9dfddf4..4f53866 100644 --- a/server/server/log.cpp +++ b/server/server/log.cpp @@ -51,10 +51,12 @@ logtofile::logtofile(const char *pth) { if(pth) path = strdup(pth); -} -logtofile::logtofile() -{ - path = strdup("./server.log"); + else + { + std::string cfg_path = boost::filesystem::initial_path().string(); + cfg_path += "/server.log"; + path = strdup(cfg_path.c_str()); + } } logtofile::~logtofile() { diff --git a/server/server/log.h b/server/server/log.h index c55772a..f0898af 100644 --- a/server/server/log.h +++ b/server/server/log.h @@ -12,8 +12,7 @@ public: logtofile& operator<<(size_t buf); logtofile& operator<<(char buf); ~logtofile(); - logtofile(const char *pth); - logtofile(); + logtofile(const char *pth = NULL); void lock() { log_mutex2.lock(); diff --git a/server/server/main.cpp b/server/server/main.cpp index daa8a2d..1d36462 100644 --- a/server/server/main.cpp +++ b/server/server/main.cpp @@ -1137,10 +1137,19 @@ int main(int argc, char* argv[]) if (!cfg_path.empty()) cfg = new config(cfg_path.c_str()); else - cfg = new config("./server.cfg"); - - logger = new logtofile(cfg->log_path().c_str()); - dos_logger = new logtofile(cfg->dos_log_path().c_str()); + cfg = new config; + if(!cfg->log_path().empty()) + logger = new logtofile(cfg->log_path().c_str()); + else + logger = new logtofile; + if(!cfg->dos_log_path().empty()) + dos_logger = new logtofile(cfg->dos_log_path().c_str()); + else + { + std::string cfg_path = boost::filesystem::initial_path().string(); + cfg_path += "/server.log"; + dos_logger = new logtofile(cfg_path.c_str()); + } while(true) { try |