Files
projectm/src/libprojectM/Utils.cpp
Kai Blaschke f2a0277ddd Fix texture loading if casing mismatches filename
Always use lower-case unqualified names to find and cache the actual textures.
2024-10-07 12:08:44 +02:00

34 lines
635 B
C++

#include "Utils.hpp"
#include <algorithm>
namespace libprojectM {
namespace Utils {
auto ToLower(const std::string& str) -> std::string
{
std::string lowerStr(str);
ToLowerInPlace(lowerStr);
return lowerStr;
}
auto ToUpper(const std::string& str) -> std::string
{
std::string upperStr(str);
ToUpperInPlace(upperStr);
return upperStr;
}
void ToLowerInPlace(std::string& str)
{
std::transform(str.begin(), str.end(), str.begin(), ::tolower);
}
void ToUpperInPlace(std::string& str)
{
std::transform(str.begin(), str.end(), str.begin(), ::toupper);
}
} // namespace Utils
} // namespace libprojectM