refactor path mapper

This commit is contained in:
sschepens 2026-04-04 14:34:23 -03:00 committed by GitHub
parent 5542cbaa02
commit 1e464dd513
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 13 additions and 194 deletions

View file

@ -6,7 +6,7 @@ namespace wowee {
namespace tools {
/**
* Maps WoW virtual paths to reorganized filesystem categories.
* Maps WoW virtual paths to organized filesystem categories.
*
* Input: WoW virtual path (e.g., "Creature\\Bear\\BearSkin.blp")
* Output: Category-based relative path (e.g., "creature/bear/BearSkin.blp")
@ -14,19 +14,15 @@ namespace tools {
class PathMapper {
public:
/**
* Map a WoW virtual path to a reorganized filesystem path.
* Map a WoW virtual path to a organized filesystem path.
* @param wowPath Original WoW virtual path (backslash-separated)
* @return Reorganized relative path (forward-slash separated, fully lowercased)
* @return Organized relative path (forward-slash separated, fully lowercased)
*/
static std::string mapPath(const std::string& wowPath);
private:
static std::string mapPathImpl(const std::string& wowPath);
// Helpers for prefix matching (case-insensitive)
static bool startsWithCI(const std::string& str, const std::string& prefix);
static std::string toLower(const std::string& str);
static std::string toForwardSlash(const std::string& str);
static std::string extractAfterPrefix(const std::string& path, size_t prefixLen);
};
} // namespace tools