diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index 977a98837b..c66d4aa013 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -1343,39 +1343,68 @@ CString FixSlashes( CString sPath ) void CollapsePath( CString &sPath, bool bRemoveLeadingDot ) { - /* Don't ignore empty: we do want to keep trailing slashes. */ - CStringArray as; - split( sPath, "/", as, false ); + CString sOut; + sOut.reserve( sPath.size() ); - for( unsigned i=0; i "foo/bar/", but "/foo" -> "/foo" and "foo/" - * to "foo/". */ - as.erase( as.begin()+i ); - i -= 1; - } - else if( as[i] == "." && (bRemoveLeadingDot || i != 0) ) - { - as.erase( as.begin()+i ); - i -= 1; - } + + sOut.append( sPath, iPos, iNext-iPos ); } - sPath = join( "/", as ); + + sOut.swap( sPath ); }