1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)
{
struct Ret
{
std::string folderName;
std::string baseFolder;
bool parentExists;
bool fileInFolder;
} ret;
struct Ret
{
std::string folderName;
std::string baseFolder;
bool parentExists;
bool fileInFolder;
} ret;
ret.parentExists = (curFolder != "");
ret.fileInFolder = false;
@ -773,12 +773,12 @@ std::unordered_set<ResourceID> SelectionTab::getFiles(std::string dirURI, int re
boost::to_upper(dirURI);
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)
{
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;

View File

@ -45,7 +45,7 @@ static inline EResType::Type readType(const std::string& name)
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('.');
@ -61,7 +61,8 @@ static inline std::string readName(std::string name)
name.resize(dotPos);
}
toUpper(name);
if(type != EResType::MAP && type != EResType::CAMPAIGN && type != EResType::SAVEGAME)
toUpper(name);
return name;
}
@ -75,12 +76,12 @@ ResourceID::ResourceID()
ResourceID::ResourceID(std::string name_):
type{readType(name_)},
name{readName(std::move(name_))}
name{readName(std::move(name_), readType(name_))}
{}
ResourceID::ResourceID(std::string name_, EResType::Type type_):
type{type_},
name{readName(std::move(name_))}
name{readName(std::move(name_), type_)}
{}
#if 0
std::string ResourceID::getName() const