mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-19 20:53:52 +00:00
Fix bsa file loading not being case insensitive (Fixes #1178)
This commit is contained in:
parent
f629307f60
commit
3cd835e61a
3 changed files with 30 additions and 9 deletions
|
@ -42,7 +42,7 @@ void ESMStore::load(ESM::ESMReader &esm, Loading::Listener* listener)
|
||||||
for (int i = 0; i < esm.getIndex(); i++) {
|
for (int i = 0; i < esm.getIndex(); i++) {
|
||||||
const std::string &candidate = allPlugins->at(i).getContext().filename;
|
const std::string &candidate = allPlugins->at(i).getContext().filename;
|
||||||
std::string fnamecandidate = boost::filesystem::path(candidate).filename().string();
|
std::string fnamecandidate = boost::filesystem::path(candidate).filename().string();
|
||||||
if (fname == fnamecandidate) {
|
if (Misc::StringUtils::ciEqual(fname, fnamecandidate)) {
|
||||||
index = i;
|
index = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
#include "collections.hpp"
|
#include "collections.hpp"
|
||||||
|
|
||||||
|
#include <components/misc/stringops.hpp>
|
||||||
|
|
||||||
namespace Files
|
namespace Files
|
||||||
{
|
{
|
||||||
Collections::Collections()
|
Collections::Collections()
|
||||||
|
@ -36,10 +37,20 @@ namespace Files
|
||||||
for (Files::PathContainer::const_iterator iter = mDirectories.begin();
|
for (Files::PathContainer::const_iterator iter = mDirectories.begin();
|
||||||
iter != mDirectories.end(); ++iter)
|
iter != mDirectories.end(); ++iter)
|
||||||
{
|
{
|
||||||
const boost::filesystem::path path = *iter / file;
|
for (boost::filesystem::directory_iterator iter2 (*iter);
|
||||||
if (boost::filesystem::exists(path))
|
iter2!=boost::filesystem::directory_iterator(); ++iter2)
|
||||||
|
{
|
||||||
|
boost::filesystem::path path = *iter2;
|
||||||
|
|
||||||
|
if (mFoldCase)
|
||||||
|
{
|
||||||
|
if (Misc::StringUtils::ciEqual(file, path.filename().string()))
|
||||||
return path.string();
|
return path.string();
|
||||||
}
|
}
|
||||||
|
else if (path.filename().string() == file)
|
||||||
|
return path.string();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
throw std::runtime_error ("file " + file + " not found");
|
throw std::runtime_error ("file " + file + " not found");
|
||||||
}
|
}
|
||||||
|
@ -49,10 +60,20 @@ namespace Files
|
||||||
for (Files::PathContainer::const_iterator iter = mDirectories.begin();
|
for (Files::PathContainer::const_iterator iter = mDirectories.begin();
|
||||||
iter != mDirectories.end(); ++iter)
|
iter != mDirectories.end(); ++iter)
|
||||||
{
|
{
|
||||||
const boost::filesystem::path path = *iter / file;
|
for (boost::filesystem::directory_iterator iter2 (*iter);
|
||||||
if (boost::filesystem::exists(path))
|
iter2!=boost::filesystem::directory_iterator(); ++iter2)
|
||||||
|
{
|
||||||
|
boost::filesystem::path path = *iter2;
|
||||||
|
|
||||||
|
if (mFoldCase)
|
||||||
|
{
|
||||||
|
if (Misc::StringUtils::ciEqual(file, path.filename().string()))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (path.filename().string() == file)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -417,7 +417,7 @@
|
||||||
<UserString key="SettingType" value="CheckButton"/>
|
<UserString key="SettingType" value="CheckButton"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
<Widget type="AutoSizedTextBox" skin="SandText" align="Left Top">
|
<Widget type="AutoSizedTextBox" skin="SandText" align="Left Top">
|
||||||
<Property key="Caption" value="Enabled"/>
|
<Property key="Caption" value="Shadows"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue