Make CollapsePath strip "." and empty path entries "foo//bar"

This commit is contained in:
Glenn Maynard
2003-12-11 06:51:54 +00:00
parent 24760c03ee
commit a8365e11b6
+6 -1
View File
@@ -33,7 +33,7 @@ CString FixSlashes( CString sPath )
void CollapsePath( CString &sPath )
{
CStringArray as;
split( sPath, "/", as );
split( sPath, "/", as, true );
for( unsigned i=0; i<as.size(); i++ )
{
@@ -43,6 +43,11 @@ void CollapsePath( CString &sPath )
as.erase( as.begin()+i-1 );
i -= 2;
}
else if( as[i] == "." )
{
as.erase( as.begin()+i );
i -= 1;
}
}
sPath = join( "/", as );
}