2026-02-12 20:32:14 -08:00
|
|
|
#include "path_mapper.hpp"
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
#include <cctype>
|
|
|
|
|
|
|
|
|
|
namespace wowee {
|
|
|
|
|
namespace tools {
|
|
|
|
|
|
|
|
|
|
std::string PathMapper::toLower(const std::string& str) {
|
|
|
|
|
std::string result = str;
|
|
|
|
|
std::transform(result.begin(), result.end(), result.begin(),
|
|
|
|
|
[](unsigned char c) { return static_cast<char>(std::tolower(c)); });
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string PathMapper::toForwardSlash(const std::string& str) {
|
|
|
|
|
std::string result = str;
|
|
|
|
|
std::replace(result.begin(), result.end(), '\\', '/');
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string PathMapper::mapPath(const std::string& wowPath) {
|
2026-04-03 21:26:20 -07:00
|
|
|
// Lowercase entire output path — WoW archives contain mixed-case variants
|
|
|
|
|
// of the same path which create duplicate directories on case-sensitive filesystems.
|
2026-04-04 14:34:23 -03:00
|
|
|
return toLower(toForwardSlash(wowPath));
|
2026-02-12 20:32:14 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace tools
|
|
|
|
|
} // namespace wowee
|