Make CollapsePath strip "." and empty path entries "foo//bar"
This commit is contained in:
@@ -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 );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user