fix CollapsePath("/foo") resulting in "foo"

This commit is contained in:
Glenn Maynard
2004-03-03 00:35:00 +00:00
parent 8ed0a43570
commit 98dba2b870
+4 -2
View File
@@ -1054,9 +1054,11 @@ void CollapsePath( CString &sPath, bool bRemoveLeadingDot )
as.erase( as.begin()+i-1 ); as.erase( as.begin()+i-1 );
i -= 2; i -= 2;
} }
else if( as[i] == "" && i+1 < as.size() ) else if( as[i] == "" && i != 0 && i+1 < as.size() )
{ {
/* Remove empty parts that aren't at the end; "foo//bar/" -> "foo/bar/". */ /* Remove empty parts that aren't at the beginning or end;
* "foo//bar/" -> "foo/bar/", but "/foo" -> "/foo" and "foo/"
* to "foo/". */
as.erase( as.begin()+i ); as.erase( as.begin()+i );
i -= 1; i -= 1;
} }