From 98dba2b8702dade701f337fd10ed30d358c947e9 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 3 Mar 2004 00:35:00 +0000 Subject: [PATCH] fix CollapsePath("/foo") resulting in "foo" --- stepmania/src/RageUtil.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index 1b6e060011..388a02efa8 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -1054,9 +1054,11 @@ void CollapsePath( CString &sPath, bool bRemoveLeadingDot ) as.erase( as.begin()+i-1 ); 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 ); i -= 1; }