While I'm at it, remove leading and trailing slashes to make the cache files look like "Songs_foo" instead of "_Songs_foo_".

This commit is contained in:
Steve Checkoway
2006-07-24 08:35:33 +00:00
parent 9a21d52d0b
commit ab978ef733
2 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -34,7 +34,7 @@
#include <set>
#include <float.h>
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;
+6 -1
View File
@@ -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