mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-27 06:42:23 +00:00
Don't add dirs twice to the search path.
This can happen in some special cases, like basedir == binarydir. A common case is Windows. If -basedir isn't given, basedir is set to '.' and we end up with basedir == binarydir. In theory adding a dir twice shouldn't be problem, because the first addition always matches and the second addition is ignored. But I'm not sure if that always the case in practice.
This commit is contained in:
parent
1a913eb7d1
commit
f663d08922
1 changed files with 11 additions and 2 deletions
|
@ -1819,7 +1819,7 @@ void FS_AddDirToRawPath (const char *rawdir, qboolean create) {
|
|||
}
|
||||
}
|
||||
|
||||
// Make sure that the dir doesn't end with a slash
|
||||
// Make sure that the dir doesn't end with a slash.
|
||||
for (size_t s = strlen(dir) - 1; s >= 0; s--)
|
||||
{
|
||||
if (dir[s] == '/')
|
||||
|
@ -1832,7 +1832,16 @@ void FS_AddDirToRawPath (const char *rawdir, qboolean create) {
|
|||
}
|
||||
}
|
||||
|
||||
// Add the directory
|
||||
// Bail out if the dir was already added.
|
||||
for (fsRawPath_t *search = fs_rawPath; search; search = search->next)
|
||||
{
|
||||
if (strcmp(search->path, dir) == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Add the directory.
|
||||
fsRawPath_t *search = Z_Malloc(sizeof(fsRawPath_t));
|
||||
Q_strlcpy(search->path, dir, sizeof(search->path));
|
||||
search->create = create;
|
||||
|
|
Loading…
Reference in a new issue