filesystem: fix ClearSearchPath
This commit is contained in:
parent
0984368a31
commit
e95161aa14
1 changed files with 15 additions and 12 deletions
|
@ -373,24 +373,27 @@ FS_ClearSearchPath
|
||||||
*/
|
*/
|
||||||
void FS_ClearSearchPath( void )
|
void FS_ClearSearchPath( void )
|
||||||
{
|
{
|
||||||
while( fs_searchpaths )
|
searchpath_t *cur, **prev;
|
||||||
|
|
||||||
|
prev = &fs_searchpaths;
|
||||||
|
|
||||||
|
while( true )
|
||||||
{
|
{
|
||||||
searchpath_t *search = fs_searchpaths;
|
cur = *prev;
|
||||||
|
|
||||||
if( !search ) break;
|
if( !cur )
|
||||||
|
break;
|
||||||
|
|
||||||
if( FBitSet( search->flags, FS_STATIC_PATH ))
|
// never delete static paths
|
||||||
|
if( FBitSet( cur->flags, FS_STATIC_PATH ))
|
||||||
{
|
{
|
||||||
// skip read-only pathes
|
prev = &cur->next;
|
||||||
if( search->next )
|
continue;
|
||||||
fs_searchpaths = search->next->next;
|
|
||||||
else break;
|
|
||||||
}
|
}
|
||||||
else fs_searchpaths = search->next;
|
|
||||||
|
|
||||||
search->pfnClose( search );
|
*prev = cur->next;
|
||||||
|
cur->pfnClose( cur );
|
||||||
Mem_Free( search );
|
Mem_Free( cur );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue