From 80d16e87e8fc19316366109b9f41df81c9567d03 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 5 May 2003 08:26:30 +0000 Subject: [PATCH] make sprite files a wildcard match, which is more robust handle case-insensitivity --- stepmania/src/Sprite.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index 297a90a988..eb993f3125 100644 --- a/stepmania/src/Sprite.cpp +++ b/stepmania/src/Sprite.cpp @@ -98,9 +98,22 @@ bool Sprite::LoadFromSpriteFile( RageTextureID ID ) RageException::Throw( "Error reading value 'Texture' from %s.", m_sSpritePath.c_str() ); ID.filename = sFontDir + sTextureFile; // save the path of the real texture + { + vector asElementPaths; + GetDirListing( ID.filename + "*", asElementPaths, false, true ); + if(asElementPaths.size() == 0) + RageException::Throw( "The sprite file '%s' points to a texture '%s' which doesn't exist.", m_sSpritePath.c_str(), ID.filename.c_str() ); + if(asElementPaths.size() > 1) + { + CString message = ssprintf( + "There is more than one file that matches " + "'%s/%s'. Please remove all but one of these matches.", + ID.filename.c_str() ); - if( !DoesFileExist(ID.filename) ) - RageException::Throw( "The sprite file '%s' points to a texture '%s' which doesn't exist.", m_sSpritePath.c_str(), ID.filename.c_str() ); + RageException::Throw( message ); + } + ID.filename = asElementPaths[0]; + } // Load the texture LoadFromTexture( ID );