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 utf8[2048];
|
||||
int i;
|
||||
char fbase[MAX_QPATH];
|
||||
char fname[MAX_QPATH];
|
||||
conchar_t cline[2048], *c;
|
||||
unsigned int u;
|
||||
|
@ -146,9 +147,10 @@ void Log_String (logtype_t lognum, char *s)
|
|||
*t = 0;
|
||||
|
||||
if (*d)
|
||||
Q_snprintfz(fname, sizeof(fname), "%s/%s.log", d, f);
|
||||
Q_snprintfz(fbase, sizeof(fname)-4, "%s/%s", d, f);
|
||||
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
|
||||
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;
|
||||
|
||||
// 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);
|
||||
|
||||
// rename files through chain
|
||||
for (x = i-1; x > 0; x--)
|
||||
{
|
||||
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
|
||||
if ((fi = FS_OpenVFS(oldf, "rb", FS_GAMEONLY)))
|
||||
|
|
Loading…
Reference in a new issue