From 36a6df8a3458d32168e260293b029ecf815e7dca Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 8 Sep 2013 11:27:49 +0200 Subject: [PATCH] ProtoProxy: Logs are saved to a Logs subfolder. --- Tools/ProtoProxy/.gitignore | 1 + Tools/ProtoProxy/Connection.cpp | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Tools/ProtoProxy/.gitignore b/Tools/ProtoProxy/.gitignore index 3097f7aab..2a38341e5 100644 --- a/Tools/ProtoProxy/.gitignore +++ b/Tools/ProtoProxy/.gitignore @@ -1,4 +1,5 @@ Debug Release +Logs/ *.log *.nbt diff --git a/Tools/ProtoProxy/Connection.cpp b/Tools/ProtoProxy/Connection.cpp index 55ba74a87..e985c2ff6 100644 --- a/Tools/ProtoProxy/Connection.cpp +++ b/Tools/ProtoProxy/Connection.cpp @@ -8,6 +8,9 @@ #include "Server.h" #include +#ifdef _WIN32 + #include // For _mkdir() +#endif @@ -261,7 +264,14 @@ cConnection::cConnection(SOCKET a_ClientSocket, cServer & a_Server) : m_ServerBuffer(1024 KiB), m_HasClientPinged(false) { - Printf(m_LogNameBase, "Log_%d", (int)time(NULL)); + // Create the Logs subfolder, if not already created: + #if defined(_WIN32) + _mkdir("Logs"); + #else + mkdir("Logs", 0777); + #endif + + Printf(m_LogNameBase, "Logs/Log_%d", (int)time(NULL)); AString fnam(m_LogNameBase); fnam.append(".log"); m_LogFile = fopen(fnam.c_str(), "w");