split out FilenameDB::DelFileSet
This commit is contained in:
@@ -324,15 +324,15 @@ void FilenameDB::AddFile( const CString &sPath, int size, int hash, void *priv )
|
||||
} while( begin != end );
|
||||
}
|
||||
|
||||
void FilenameDB::DelFile( const CString &sPath )
|
||||
/* Remove the given FileSet, and all dirp pointers to it. This means the cache has
|
||||
* expired, not that the directory is necessarily gone; don't actually delete the file
|
||||
* from the parent. */
|
||||
void FilenameDB::DelFileSet( map<CString, FileSet *>::iterator dir )
|
||||
{
|
||||
CString lower = sPath;
|
||||
lower.MakeLower();
|
||||
if( dir == dirs.end() )
|
||||
return;
|
||||
|
||||
map<CString, FileSet *>::iterator fsi = dirs.find( lower );
|
||||
if( fsi != dirs.end() )
|
||||
{
|
||||
FileSet *fs = fsi->second;
|
||||
FileSet *fs = dir->second;
|
||||
|
||||
/* Remove any stale dirp pointers. */
|
||||
for( map<CString, FileSet *>::iterator it = dirs.begin(); it != dirs.end(); ++it )
|
||||
@@ -347,9 +347,17 @@ void FilenameDB::DelFile( const CString &sPath )
|
||||
}
|
||||
|
||||
delete fs;
|
||||
dirs.erase( fsi );
|
||||
dirs.erase( dir );
|
||||
}
|
||||
|
||||
void FilenameDB::DelFile( const CString &sPath )
|
||||
{
|
||||
CString lower = sPath;
|
||||
lower.MakeLower();
|
||||
|
||||
map<CString, FileSet *>::iterator fsi = dirs.find( lower );
|
||||
DelFileSet( fsi );
|
||||
|
||||
/* Delete sPath from its parent. */
|
||||
CString Dir, Name;
|
||||
SplitPath(sPath, Dir, Name);
|
||||
|
||||
@@ -81,6 +81,7 @@ protected:
|
||||
const CString &beginning, const CString &containing, const CString &ending,
|
||||
vector<CString> &out, bool bOnlyDirs);
|
||||
void AddFileSet( CString sPath, FileSet *fs );
|
||||
void DelFileSet( map<CString, FileSet *>::iterator dir );
|
||||
|
||||
/* The given path wasn't cached. Cache it. */
|
||||
virtual void PopulateFileSet( FileSet &fs, const CString &sPath ) { }
|
||||
|
||||
Reference in New Issue
Block a user