1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-17 01:32:21 +02:00

case handling

This commit is contained in:
Michael
2023-08-11 01:46:22 +02:00
committed by GitHub
parent 092a0d72a1
commit 2b093b8850
2 changed files with 14 additions and 13 deletions

View File

@ -357,13 +357,13 @@ void SelectionTab::showPopupWindow(const Point & cursorPosition)
auto SelectionTab::checkSubfolder(std::string path) auto SelectionTab::checkSubfolder(std::string path)
{ {
struct Ret struct Ret
{ {
std::string folderName; std::string folderName;
std::string baseFolder; std::string baseFolder;
bool parentExists; bool parentExists;
bool fileInFolder; bool fileInFolder;
} ret; } ret;
ret.parentExists = (curFolder != ""); ret.parentExists = (curFolder != "");
ret.fileInFolder = false; ret.fileInFolder = false;
@ -773,12 +773,12 @@ std::unordered_set<ResourceID> SelectionTab::getFiles(std::string dirURI, int re
boost::to_upper(dirURI); boost::to_upper(dirURI);
CResourceHandler::get()->updateFilteredFiles([&](const std::string & mount) CResourceHandler::get()->updateFilteredFiles([&](const std::string & mount)
{ {
return boost::algorithm::starts_with(mount, dirURI); return boost::algorithm::starts_with(boost::algorithm::to_upper_copy(mount), dirURI);
}); });
std::unordered_set<ResourceID> ret = CResourceHandler::get()->getFilteredFiles([&](const ResourceID & ident) std::unordered_set<ResourceID> ret = CResourceHandler::get()->getFilteredFiles([&](const ResourceID & ident)
{ {
return ident.getType() == resType && boost::algorithm::starts_with(ident.getName(), dirURI); return ident.getType() == resType && boost::algorithm::starts_with(boost::algorithm::to_upper_copy(ident.getName()), dirURI);
}); });
return ret; return ret;

View File

@ -45,7 +45,7 @@ static inline EResType::Type readType(const std::string& name)
return EResTypeHelper::getTypeFromExtension(FileInfo::GetExtension(name).to_string()); return EResTypeHelper::getTypeFromExtension(FileInfo::GetExtension(name).to_string());
} }
static inline std::string readName(std::string name) static inline std::string readName(std::string name, EResType::Type type)
{ {
const auto dotPos = name.find_last_of('.'); const auto dotPos = name.find_last_of('.');
@ -61,7 +61,8 @@ static inline std::string readName(std::string name)
name.resize(dotPos); name.resize(dotPos);
} }
toUpper(name); if(type != EResType::MAP && type != EResType::CAMPAIGN && type != EResType::SAVEGAME)
toUpper(name);
return name; return name;
} }
@ -75,12 +76,12 @@ ResourceID::ResourceID()
ResourceID::ResourceID(std::string name_): ResourceID::ResourceID(std::string name_):
type{readType(name_)}, type{readType(name_)},
name{readName(std::move(name_))} name{readName(std::move(name_), readType(name_))}
{} {}
ResourceID::ResourceID(std::string name_, EResType::Type type_): ResourceID::ResourceID(std::string name_, EResType::Type type_):
type{type_}, type{type_},
name{readName(std::move(name_))} name{readName(std::move(name_), type_)}
{} {}
#if 0 #if 0
std::string ResourceID::getName() const std::string ResourceID::getName() const