Skip to content

Commit

Permalink
Catch the case where the previous character from the start is not a s…
Browse files Browse the repository at this point in the history
…lash
  • Loading branch information
SmileyAG committed Mar 10, 2024
1 parent 46de28a commit 83b0fb0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion BunnymodXT/helper_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ namespace helper_functions
const std::string filename = current_lib_path;
const auto index = filename.find(start);

if (index == std::string::npos)
if ((index == std::string::npos) || // String not found in current path.
((index > 0) && (filename[index - 1] != PATH_SLASH))) // Previous character from the specified start is not a slash.
return current_lib_path;

com_fixslashes(new_lib_path);
Expand Down
2 changes: 2 additions & 0 deletions BunnymodXT/helper_functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ namespace helper_functions
{
#ifdef _WIN32
#define DLL_EXTENSION ".dll"
#define PATH_SLASH '\\'
#else
#define DLL_EXTENSION ".so"
#define PATH_SLASH '/'
#endif

void com_fixslashes(std::string &str);
Expand Down

0 comments on commit 83b0fb0

Please sign in to comment.