From 9db374f31fcdff26e7a4782a28d8fb0f15c5bf6a Mon Sep 17 00:00:00 2001 From: FynnTW Date: Tue, 3 Oct 2023 18:25:55 +0300 Subject: [PATCH] ignore comments for mod verify and fix doc string --- M2TWEOP Code/M2TWEOP GUI/helpers.cpp | 21 ++++++++++++++++----- M2TWEOP-luaPlugin/luaPlugin/luaP.cpp | 1 - 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/M2TWEOP Code/M2TWEOP GUI/helpers.cpp b/M2TWEOP Code/M2TWEOP GUI/helpers.cpp index 6e0c1598..cb09e0fe 100644 --- a/M2TWEOP Code/M2TWEOP GUI/helpers.cpp +++ b/M2TWEOP Code/M2TWEOP GUI/helpers.cpp @@ -446,17 +446,28 @@ bool helpers::verifyModPath(const std::string& modPath) if (currentPathDirs.size() < 2) return false; + std::string modPathCheck = modPath + ""; + + size_t pos = modPathCheck.find("#"); + if (pos != std::string::npos) + { + modPathCheck = modPathCheck.substr(0, pos); + } + pos = modPathCheck.find(";"); + if (pos != std::string::npos) + { + modPathCheck = modPathCheck.substr(0, pos); + } + std::string lastDir = currentPathDirs[currentPathDirs.size() - 1]; std::string secondLastDir = currentPathDirs[currentPathDirs.size() - 2]; std::string expectedPath = secondLastDir + "\\" + lastDir; std::replace(expectedPath.begin(), expectedPath.end(), '/', '\\'); - std::replace(expectedPath.begin(), expectedPath.end(), ' ', ''); - std::replace(modPath.begin(), modPath.end(), '/', '\\'); - std::replace(modPath.begin(), modPath.end(), ' ', ''); + std::replace(modPathCheck.begin(), modPathCheck.end(), '/', '\\'); std::transform(expectedPath.begin(), expectedPath.end(), expectedPath.begin(), ::tolower); - std::transform(modPath.begin(), modPath.end(), modPath.begin(), ::tolower); + std::transform(modPathCheck.begin(), modPathCheck.end(), modPathCheck.begin(), ::tolower); - return modPath == expectedPath; + return modPathCheck == expectedPath; } std::string helpers::extractModPathFromLine(const std::string& line) diff --git a/M2TWEOP-luaPlugin/luaPlugin/luaP.cpp b/M2TWEOP-luaPlugin/luaPlugin/luaP.cpp index 340e7e95..35f16890 100644 --- a/M2TWEOP-luaPlugin/luaPlugin/luaP.cpp +++ b/M2TWEOP-luaPlugin/luaPlugin/luaP.cpp @@ -363,7 +363,6 @@ sol::state* luaP::init(std::string& luaFilePath, std::string& modPath) /*** * Sets the new maximum amount of building levels within a chain. - * WARNING: This function may be bugged -> https://github.com/youneuoy/M2TWEOP-library/issues/58 * @function M2TWEOP.setBuildingChainLimit * @tparam int limit default: 9, maximum: 57 * @usage