mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-22 12:01:25 +00:00
don't use va() within FS_Rename, fix logging logic, fix return values with morphos call
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2239 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
d593604177
commit
f0a60a1471
3 changed files with 17 additions and 11 deletions
|
@ -103,10 +103,10 @@ int Sys_DebugLog(char *file, char *fmt, ...)
|
|||
|
||||
Close(fh);
|
||||
|
||||
return true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return false;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int secbase;
|
||||
|
|
|
@ -2170,32 +2170,38 @@ int FS_Rename2(char *oldf, char *newf, int oldrelativeto, int newrelativeto)
|
|||
}
|
||||
int FS_Rename(char *oldf, char *newf, int relativeto)
|
||||
{
|
||||
char fullname[MAX_OSPATH];
|
||||
char oldfullname[MAX_OSPATH];
|
||||
char newfullname[MAX_OSPATH];
|
||||
|
||||
switch (relativeto)
|
||||
{
|
||||
case FS_GAME:
|
||||
if (*com_homedir)
|
||||
snprintf(fullname, sizeof(fullname), "%s%s/", com_homedir, gamedirfile);
|
||||
snprintf(oldfullname, sizeof(oldfullname), "%s%s/", com_homedir, gamedirfile);
|
||||
else
|
||||
snprintf(fullname, sizeof(fullname), "%s%s/", com_quakedir, gamedirfile);
|
||||
snprintf(oldfullname, sizeof(oldfullname), "%s%s/", com_quakedir, gamedirfile);
|
||||
break;
|
||||
case FS_SKINS:
|
||||
if (*com_homedir)
|
||||
snprintf(fullname, sizeof(fullname), "%sqw/skins/", com_homedir);
|
||||
snprintf(oldfullname, sizeof(oldfullname), "%sqw/skins/", com_homedir);
|
||||
else
|
||||
snprintf(fullname, sizeof(fullname), "%sqw/skins/", com_quakedir);
|
||||
snprintf(oldfullname, sizeof(oldfullname), "%sqw/skins/", com_quakedir);
|
||||
break;
|
||||
case FS_BASE:
|
||||
if (*com_homedir)
|
||||
snprintf(fullname, sizeof(fullname), "%s", com_homedir);
|
||||
snprintf(oldfullname, sizeof(oldfullname), "%s", com_homedir);
|
||||
else
|
||||
snprintf(fullname, sizeof(fullname), "%s", com_quakedir);
|
||||
snprintf(oldfullname, sizeof(oldfullname), "%s", com_quakedir);
|
||||
break;
|
||||
default:
|
||||
Sys_Error("FS_Rename case not handled\n");
|
||||
}
|
||||
return rename(va("%s%s", fullname, oldf), va("%s%s", fullname, newf));
|
||||
|
||||
Q_strncpy(newfullname, oldfullname, sizeof(newfullname));
|
||||
Q_strncatz(oldfullname, oldf, sizeof(oldfullname));
|
||||
Q_strncatz(newfullname, newf, sizeof(newfullname));
|
||||
|
||||
return rename(oldfullname, newfullname);
|
||||
}
|
||||
int FS_Remove(char *fname, int relativeto)
|
||||
{
|
||||
|
|
|
@ -199,7 +199,7 @@ void Con_Log (char *s)
|
|||
snprintf(oldf, sizeof(oldf)-1, "%s.%i", f, x);
|
||||
|
||||
// check if file exists, otherwise skip
|
||||
if ((fi = FS_OpenVFS(f, "rb", FS_BASE)))
|
||||
if ((fi = FS_OpenVFS(oldf, "rb", FS_BASE)))
|
||||
VFS_CLOSE(fi);
|
||||
else
|
||||
continue; // skip nonexistant files
|
||||
|
|
Loading…
Reference in a new issue