mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:23:51 +00:00
Merge remote branch 'werdanith/searchfix'
This commit is contained in:
commit
a7211d2a90
2 changed files with 13 additions and 2 deletions
|
@ -136,7 +136,7 @@ namespace MWSound
|
|||
max = std::max(min, max);
|
||||
}
|
||||
|
||||
return Files::FileListLocator(mSoundFiles, snd->sound, mFSStrict, true);
|
||||
return Files::FileListLocator(mSoundFiles, snd->sound, mFSStrict, false);
|
||||
}
|
||||
|
||||
// Add a sound to the list and play it
|
||||
|
|
|
@ -13,6 +13,14 @@ bool isFile(const char *name)
|
|||
return boost::filesystem::exists(boost::filesystem::path(name));
|
||||
}
|
||||
|
||||
// Returns true if the last part of the superset matches the subset
|
||||
bool endingMatches(const std::string& superset, const std::string& subset)
|
||||
{
|
||||
if (subset.length() > superset.length())
|
||||
return false;
|
||||
return superset.substr(superset.length() - subset.length()) == subset;
|
||||
}
|
||||
|
||||
// Makes a list of files from a directory
|
||||
void FileLister( boost::filesystem::path currentPath, Files::PathContainer& list, bool recursive)
|
||||
{
|
||||
|
@ -85,11 +93,14 @@ bool isFile(const char *name)
|
|||
for (Files::PathContainer::const_iterator it = list.begin(); it != list.end(); ++it)
|
||||
{
|
||||
fullPath = it->string();
|
||||
if (ignoreExtensions)
|
||||
fullPath.erase(fullPath.length() - it->extension().string().length());
|
||||
|
||||
if (!strict)
|
||||
{
|
||||
boost::algorithm::to_lower(fullPath);
|
||||
}
|
||||
if(fullPath.find(toFindStr) != std::string::npos)
|
||||
if(endingMatches(fullPath, toFindStr))
|
||||
{
|
||||
result = *it;
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue