From ab978ef7332efd331bb244d2f63e8a920289bea2 Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Mon, 24 Jul 2006 08:35:33 +0000 Subject: [PATCH] While I'm at it, remove leading and trailing slashes to make the cache files look like "Songs_foo" instead of "_Songs_foo_". --- stepmania/src/Song.cpp | 2 +- stepmania/src/SongCacheIndex.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index 5596d834c3..03ea37fde2 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -34,7 +34,7 @@ #include #include -const int FILE_CACHE_VERSION = 146; // increment this to invalidate cache +const int FILE_CACHE_VERSION = 147; // increment this to invalidate cache const float DEFAULT_MUSIC_SAMPLE_LENGTH = 12.f; diff --git a/stepmania/src/SongCacheIndex.cpp b/stepmania/src/SongCacheIndex.cpp index 7031e59986..a87259556f 100644 --- a/stepmania/src/SongCacheIndex.cpp +++ b/stepmania/src/SongCacheIndex.cpp @@ -33,7 +33,12 @@ RString SongCacheIndex::GetCacheFilePath( const RString &sGroup, const RString & { /* Don't use GetHashForFile, since we don't want to spend time * checking the file size and date. */ - RString s = sPath; + RString s; + + if( sPath.size() > 2 && sPath[0] == '/' && sPath[sPath.size()-1] == '/' ) + s.assign( sPath, 1, sPath.size() - 2 ); + else + s = sPath; /* Change slashes and invalid utf-8 characters to _. * http://en.wikipedia.org/wiki/UTF-8 * Mac OS X doesn't support precomposed unicode characters in files names and