make sure log files always have a .log extension - log file rotation was generating stuff like rcon.log.1 which can be a pain to open in notepad, and also violates filename check expectations.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4796 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
4d9ee2395a
commit
1f2996a245
1 changed files with 6 additions and 4 deletions
|
@ -69,6 +69,7 @@ void Log_String (logtype_t lognum, char *s)
|
||||||
char *t;
|
char *t;
|
||||||
char utf8[2048];
|
char utf8[2048];
|
||||||
int i;
|
int i;
|
||||||
|
char fbase[MAX_QPATH];
|
||||||
char fname[MAX_QPATH];
|
char fname[MAX_QPATH];
|
||||||
conchar_t cline[2048], *c;
|
conchar_t cline[2048], *c;
|
||||||
unsigned int u;
|
unsigned int u;
|
||||||
|
@ -146,9 +147,10 @@ void Log_String (logtype_t lognum, char *s)
|
||||||
*t = 0;
|
*t = 0;
|
||||||
|
|
||||||
if (*d)
|
if (*d)
|
||||||
Q_snprintfz(fname, sizeof(fname), "%s/%s.log", d, f);
|
Q_snprintfz(fbase, sizeof(fname)-4, "%s/%s", d, f);
|
||||||
else
|
else
|
||||||
Q_snprintfz(fname, sizeof(fname), "%s.log", f);
|
Q_snprintfz(fbase, sizeof(fname)-4, "%s", f);
|
||||||
|
Q_snprintfz(fname, sizeof(fname), "%s.log", fbase);
|
||||||
|
|
||||||
// file rotation
|
// file rotation
|
||||||
if (log_rotate_size.value >= 4096 && log_rotate_files.value >= 1)
|
if (log_rotate_size.value >= 4096 && log_rotate_files.value >= 1)
|
||||||
|
@ -174,14 +176,14 @@ void Log_String (logtype_t lognum, char *s)
|
||||||
i = log_rotate_files.value;
|
i = log_rotate_files.value;
|
||||||
|
|
||||||
// unlink file at the top of the chain
|
// unlink file at the top of the chain
|
||||||
Q_snprintfz(oldf, sizeof(oldf), "%s.%i", fname, i);
|
Q_snprintfz(oldf, sizeof(oldf), "%s.%i.log", fbase, i);
|
||||||
FS_Remove(oldf, FS_GAMEONLY);
|
FS_Remove(oldf, FS_GAMEONLY);
|
||||||
|
|
||||||
// rename files through chain
|
// rename files through chain
|
||||||
for (x = i-1; x > 0; x--)
|
for (x = i-1; x > 0; x--)
|
||||||
{
|
{
|
||||||
strcpy(newf, oldf);
|
strcpy(newf, oldf);
|
||||||
Q_snprintfz(oldf, sizeof(oldf), "%s.%i", fname, x);
|
Q_snprintfz(oldf, sizeof(oldf), "%s.%i.log", fbase, x);
|
||||||
|
|
||||||
// check if file exists, otherwise skip
|
// check if file exists, otherwise skip
|
||||||
if ((fi = FS_OpenVFS(oldf, "rb", FS_GAMEONLY)))
|
if ((fi = FS_OpenVFS(oldf, "rb", FS_GAMEONLY)))
|
||||||
|
|
Loading…
Reference in a new issue