Explorar el Código

case handling

Michael hace 2 años
padre
commit
2b093b8850
Se han modificado 2 ficheros con 14 adiciones y 13 borrados
  1. 9 9
      client/lobby/SelectionTab.cpp
  2. 5 4
      lib/filesystem/ResourceID.cpp

+ 9 - 9
client/lobby/SelectionTab.cpp

@@ -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;

+ 5 - 4
lib/filesystem/ResourceID.cpp

@@ -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