Skip to content

Commit

Permalink
Avoid duplicate pack listings on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
black-sliver committed Oct 14, 2023
1 parent 45ebfb1 commit d7281fd
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/core/pack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "fileutil.h"
#include "jsonutil.h"
#include <dirent.h>
#include <stdlib.h>
#include "sha256.h"


Expand Down Expand Up @@ -419,6 +420,15 @@ void Pack::addSearchPath(const std::string& path)
return;
_searchPaths.push_back(real);
} else
#else
char* tmp = _fullpath(NULL, path.c_str(), 1024);
if (tmp) {
auto cmp = [](const std::string& s) { return strcasecmp(tmp, s.c_str()) == 0; }
if (std::find_if(_searchPaths.begin(), _searchPaths.end(), cmp) != _searchPaths.end())
return;
_searchPaths.push_back(tmp);
free(tmp);
} else
#endif
{
if (std::find(_searchPaths.begin(), _searchPaths.end(), path) != _searchPaths.end())
Expand Down

0 comments on commit d7281fd

Please sign in to comment.