Skip to content

Commit

Permalink
ignore comments for mod verify and fix doc string
Browse files Browse the repository at this point in the history
  • Loading branch information
FynnTW committed Oct 3, 2023
1 parent 4a55639 commit 9db374f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
21 changes: 16 additions & 5 deletions M2TWEOP Code/M2TWEOP GUI/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion M2TWEOP-luaPlugin/luaPlugin/luaP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9db374f

Please sign in to comment.