diff options
Diffstat (limited to '0002-fix-Deduplicate-resources-directories.patch')
-rw-r--r-- | 0002-fix-Deduplicate-resources-directories.patch | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/0002-fix-Deduplicate-resources-directories.patch b/0002-fix-Deduplicate-resources-directories.patch new file mode 100644 index 000000000000..8e795298464a --- /dev/null +++ b/0002-fix-Deduplicate-resources-directories.patch @@ -0,0 +1,64 @@ +From 684cca4d5dc6874842e0a505617abcad0f26472d Mon Sep 17 00:00:00 2001 +From: KokaKiwi <kokakiwi+git@kokakiwi.net> +Date: Sat, 11 Jun 2022 23:08:31 +0200 +Subject: [PATCH 2/3] fix: Deduplicate resources directories + +It seems to actually happens despite xdgpp already doing that... +--- + lib/libimhex/include/hex/helpers/utils.hpp | 11 +++++++++++ + lib/libimhex/source/helpers/fs.cpp | 5 +++++ + 2 files changed, 16 insertions(+) + +diff --git a/lib/libimhex/include/hex/helpers/utils.hpp b/lib/libimhex/include/hex/helpers/utils.hpp +index 3419043f..7d9d1e05 100644 +--- a/lib/libimhex/include/hex/helpers/utils.hpp ++++ b/lib/libimhex/include/hex/helpers/utils.hpp +@@ -199,6 +199,17 @@ namespace hex { + return result; + } + ++ template<typename T> ++ void deduplicateVector(std::vector<T> &items) { ++ auto end = items.end(); ++ ++ for (auto it = items.begin(); it != end; ++it) { ++ end = std::remove(it + 1, end, *it); ++ } ++ ++ items.erase(end, items.end()); ++ } ++ + std::vector<std::string> splitString(const std::string &string, const std::string &delimiter); + std::string combineStrings(const std::vector<std::string> &strings, const std::string &delimiter = ""); + std::string replaceStrings(std::string string, const std::string &search, const std::string &replace); +diff --git a/lib/libimhex/source/helpers/fs.cpp b/lib/libimhex/source/helpers/fs.cpp +index ab6e30d5..b4fce7b1 100644 +--- a/lib/libimhex/source/helpers/fs.cpp ++++ b/lib/libimhex/source/helpers/fs.cpp +@@ -1,4 +1,5 @@ + #include <hex/helpers/fs.hpp> ++#include <hex/helpers/utils.hpp> + + #include <hex/api/content_registry.hpp> + #include <hex/helpers/fs_macos.hpp> +@@ -166,6 +167,8 @@ namespace hex::fs { + auto additionalDirs = ImHexApi::System::getAdditionalFolderPaths(); + std::copy(additionalDirs.begin(), additionalDirs.end(), std::back_inserter(paths)); + ++ hex::deduplicateVector(paths); ++ + return paths; + } + +@@ -185,6 +188,8 @@ namespace hex::fs { + for (auto &path : paths) + path = path / "imhex"; + ++ hex::deduplicateVector(paths); ++ + return paths; + #endif + } +-- +2.38.1 + |