Don't traverse the entire HOME directory to find wads

This commit is contained in:
Hanicef 2024-03-20 19:23:13 +01:00
parent 940756ad62
commit 8794e411bd
2 changed files with 15 additions and 3 deletions

View file

@ -1433,9 +1433,15 @@ static const char *locateWad(void)
#ifndef NOHOME
// find in $HOME
I_OutputMsg(",HOME");
I_OutputMsg(",HOME/.srb2");
if ((envstr = I_GetEnv("HOME")) != NULL)
{
char *tmp = malloc(strlen(envstr) + sizeof("/.srb2"));
strcpy(tmp, envstr);
strcat(tmp, "/.srb2");
SEARCHWAD(envstr);
free(tmp);
}
#endif
// search paths

View file

@ -3038,10 +3038,16 @@ static const char *locateWad(void)
}
#ifndef NOHOME
// find in $HOME
I_OutputMsg(",HOME");
// find in $HOME/.srb2
I_OutputMsg(",HOME/.srb2");
if ((envstr = I_GetEnv("HOME")) != NULL)
{
char *tmp = malloc(strlen(envstr) + sizeof("/.srb2"));
strcpy(tmp, envstr);
strcat(tmp, "/.srb2");
SEARCHWAD(envstr);
free(tmp);
}
#endif
// search paths