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 );
|
} 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;
|
if( dir == dirs.end() )
|
||||||
lower.MakeLower();
|
return;
|
||||||
|
|
||||||
map<CString, FileSet *>::iterator fsi = dirs.find( lower );
|
FileSet *fs = dir->second;
|
||||||
if( fsi != dirs.end() )
|
|
||||||
{
|
|
||||||
FileSet *fs = fsi->second;
|
|
||||||
|
|
||||||
/* Remove any stale dirp pointers. */
|
/* Remove any stale dirp pointers. */
|
||||||
for( map<CString, FileSet *>::iterator it = dirs.begin(); it != dirs.end(); ++it )
|
for( map<CString, FileSet *>::iterator it = dirs.begin(); it != dirs.end(); ++it )
|
||||||
@@ -347,9 +347,17 @@ void FilenameDB::DelFile( const CString &sPath )
|
|||||||
}
|
}
|
||||||
|
|
||||||
delete fs;
|
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. */
|
/* Delete sPath from its parent. */
|
||||||
CString Dir, Name;
|
CString Dir, Name;
|
||||||
SplitPath(sPath, Dir, Name);
|
SplitPath(sPath, Dir, Name);
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ protected:
|
|||||||
const CString &beginning, const CString &containing, const CString &ending,
|
const CString &beginning, const CString &containing, const CString &ending,
|
||||||
vector<CString> &out, bool bOnlyDirs);
|
vector<CString> &out, bool bOnlyDirs);
|
||||||
void AddFileSet( CString sPath, FileSet *fs );
|
void AddFileSet( CString sPath, FileSet *fs );
|
||||||
|
void DelFileSet( map<CString, FileSet *>::iterator dir );
|
||||||
|
|
||||||
/* The given path wasn't cached. Cache it. */
|
/* The given path wasn't cached. Cache it. */
|
||||||
virtual void PopulateFileSet( FileSet &fs, const CString &sPath ) { }
|
virtual void PopulateFileSet( FileSet &fs, const CString &sPath ) { }
|
||||||
|
|||||||
Reference in New Issue
Block a user