mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
Merge remote branch 'werdanith/searchfix'
This commit is contained in:
commit
a7211d2a90
@ -136,7 +136,7 @@ namespace MWSound
|
|||||||
max = std::max(min, max);
|
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
|
// 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));
|
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
|
// Makes a list of files from a directory
|
||||||
void FileLister( boost::filesystem::path currentPath, Files::PathContainer& list, bool recursive)
|
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)
|
for (Files::PathContainer::const_iterator it = list.begin(); it != list.end(); ++it)
|
||||||
{
|
{
|
||||||
fullPath = it->string();
|
fullPath = it->string();
|
||||||
|
if (ignoreExtensions)
|
||||||
|
fullPath.erase(fullPath.length() - it->extension().string().length());
|
||||||
|
|
||||||
if (!strict)
|
if (!strict)
|
||||||
{
|
{
|
||||||
boost::algorithm::to_lower(fullPath);
|
boost::algorithm::to_lower(fullPath);
|
||||||
}
|
}
|
||||||
if(fullPath.find(toFindStr) != std::string::npos)
|
if(endingMatches(fullPath, toFindStr))
|
||||||
{
|
{
|
||||||
result = *it;
|
result = *it;
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user