requested fixes my last commit: proper null checks + undid my removal of a slash + fixed my previous use of va()

This commit is contained in:
JBerg 2019-01-04 07:49:55 -05:00 committed by Daniel Gibson
parent be8bab6603
commit 867046bb8b
3 changed files with 6 additions and 5 deletions

View file

@ -496,6 +496,7 @@ Sys_Rename(const char *from, const char *to)
void
Sys_RemoveDir(const char *path)
{
char filepath[MAX_OSPATH];
DIR *directory = opendir(path);
struct dirent *file;
@ -503,11 +504,11 @@ Sys_RemoveDir(const char *path)
{
while ((file = readdir(directory)) != NULL)
{
Sys_Remove(va("%s%s", path, file->d_name));
sprintf(filepath, "%s/%s", path, file->d_name);
Sys_Remove(filepath);
}
closedir(directory);
Sys_Remove(path);
}
}

View file

@ -2408,7 +2408,7 @@ LoadGame_MenuKey(int key)
case K_DEL:
if ((item = Menu_ItemAtCursor(m)) != 0)
if ((item = Menu_ItemAtCursor(m)) != NULL)
{
if (item->type == MTYPE_ACTION)
{
@ -2539,7 +2539,7 @@ SaveGame_MenuKey(int key)
case K_DEL:
if ((item = Menu_ItemAtCursor(m)) != 0)
if ((item = Menu_ItemAtCursor(m)) != NULL)
{
if (item->type == MTYPE_ACTION)
{

View file

@ -1504,7 +1504,7 @@ void FS_BuildGenericSearchPath(void) {
fsRawPath_t *search = fs_rawPath;
while (search != NULL) {
Com_sprintf(path, sizeof(path), "%s%s", search->path, BASEDIRNAME);
Com_sprintf(path, sizeof(path), "%s/%s", search->path, BASEDIRNAME);
FS_AddDirToSearchPath(path, search->create);
search = search->next;