fixed music bug for Momir and Random game types. The functions that determined if a file existed did not handle errors properly. Instead it would return an empty string which when appended to the base path would always return true. Thus a non-existent file would always be treated as if it existed. The guards I put in test for empty strings before continuing evaluation. I may have been a little judicious in the places where I put the gaurds in. We can remove the guards if it turns out we don't need them in all the places.
This commit is contained in:
@@ -196,6 +196,8 @@ bool JFileSystem::DirExists(const string& strDirname)
|
||||
|
||||
bool JFileSystem::FileExists(const string& strFilename)
|
||||
{
|
||||
if (strFilename.length() < 1 ) return false;
|
||||
|
||||
return (mSystemFS && mSystemFS->FileExists(strFilename)) || mUserFS->FileExists(strFilename);
|
||||
}
|
||||
|
||||
|
||||
@@ -299,6 +299,7 @@ bool filesystem::DirExists(const std::string & folderName)
|
||||
|
||||
bool filesystem::FileExists(const std::string & fileName)
|
||||
{
|
||||
if (fileName.length() < 1) return false;
|
||||
//Check in zip
|
||||
file_info FileInfo;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user