From d7281fdb8bd61759c0bd13429df8ad0dbf316d58 Mon Sep 17 00:00:00 2001 From: black-sliver <59490463+black-sliver@users.noreply.github.com> Date: Sat, 14 Oct 2023 23:12:41 +0200 Subject: [PATCH] Avoid duplicate pack listings on Windows --- src/core/pack.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/core/pack.cpp b/src/core/pack.cpp index 134930a8..4efbc3c1 100644 --- a/src/core/pack.cpp +++ b/src/core/pack.cpp @@ -2,6 +2,7 @@ #include "fileutil.h" #include "jsonutil.h" #include +#include #include "sha256.h" @@ -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())