Merge branch 'avoid-traversing-home' into 'next'

Don't traverse the entire HOME directory to find wads

See merge request STJr/SRB2!2396
This commit is contained in:
sphere 2024-06-05 21:33:18 +00:00
commit 7cff7f7746
2 changed files with 14 additions and 2 deletions

View file

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

View file

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