Changed: #991 Make sure all debug files are created in log directory

This commit is contained in:
kervala 2010-06-21 20:37:46 +02:00
parent 1d95df22f9
commit c92b3e033d
4 changed files with 25 additions and 9 deletions

View file

@ -561,6 +561,12 @@ struct CFile
*/
static bool isExists (const std::string& filename);
/**
* Create an empty file.
* Return true if the file has been correctly created.
*/
static bool createEmptyFile (const std::string& filename);
/**
* Return a new filename that doesn't exists. It's used for screenshot filename for example.
* example: findNewFile("foobar.tga");

View file

@ -1535,7 +1535,7 @@ bool CDriverGL::activeEXTVertexShader (CVertexProgram *program)
}
/*
FILE *f = fopen("c:\\test.txt", "wb");
FILE *f = fopen(getLogDirectory() + "test.txt", "wb");
if (f)
{
std::string vpText;

View file

@ -1755,6 +1755,19 @@ bool CFile::isExists (const string &filename)
#endif // NL_OS_WINDOWS
}
bool CFile::createEmptyFile (const std::string& filename)
{
FILE *file = fopen (filename.c_str(), "wb");
if (file)
{
fclose (file);
return true;
}
return false;
}
bool CFile::fileExists (const string& filename)
{
//H_AUTO(FileExists);

View file

@ -22,6 +22,7 @@
#include "nel/misc/ucstring.h"
#include "nel/misc/report.h"
#include "nel/misc/path.h"
#ifdef NL_OS_WINDOWS
# define NOMINMAX
@ -95,15 +96,13 @@ static void sendEmail()
// EnableWindow(sendReport, FALSE);
// MessageBox (dialog, "The email was successfully sent", "email", MB_OK);
#ifndef NL_NO_DEBUG_FILES
FILE *file = fopen ("report_sent", "wb");
fclose (file);
CFile::createEmptyFile(getLogDirectory() + "report_sent");
#endif
}
else
{
#ifndef NL_NO_DEBUG_FILES
FILE *file = fopen ("report_failed", "wb");
fclose (file);
CFile::createEmptyFile(getLogDirectory() + "report_failed");
#endif
// MessageBox (dialog, "Failed to send the email", "email", MB_OK | MB_ICONERROR);
}
@ -111,8 +110,7 @@ static void sendEmail()
else
{
#ifndef NL_NO_DEBUG_FILES
FILE *file = fopen ("report_refused", "wb");
fclose (file);
CFile::createEmptyFile(getLogDirectory() + "report_refused");
#endif
}
}
@ -171,8 +169,7 @@ static LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM
{
EnableWindow(sendReport, FALSE);
MessageBox (dialog, "The email was successfully sent", "email", MB_OK);
FILE *file = fopen ("report_sent", "wb");
fclose (file);
CFile::createEmptyFile(getLogDirectory() + "report_sent");
}
else
{