FilenameDB::ResolvePath doesn't accept . or ..

This commit is contained in:
Glenn Maynard
2004-02-27 06:26:14 +00:00
parent 74eb8a43ee
commit b46f5602d7
+3
View File
@@ -130,6 +130,7 @@ int FilenameDB::GetFileHash( const CString &sPath )
return fs->GetFileHash(Name);
}
/* path should be fully collapsed, so we can operate in-place: no . or .. */
bool FilenameDB::ResolvePath(CString &path)
{
if( path == "." || path == "" )
@@ -153,6 +154,8 @@ bool FilenameDB::ResolvePath(CString &path)
fs = GetFileSet( ret );
CString p = path.substr( begin, size );
RAGE_ASSERT_M( p.size() != 1 || p[0] != '.', path ); // no .
RAGE_ASSERT_M( p.size() != 2 || p[0] != '.' || p[1] != '.', path ); // no ..
set<File>::iterator it = fs->files.find( File(p) );
/* If there were no matches, the path isn't found. */