From 047c44f265d01b754353b15bd6a7f4aafc7d909d Mon Sep 17 00:00:00 2001 From: scrawl <720642+scrawl@users.noreply.github.com> Date: Sun, 14 Jan 2018 00:25:20 +0000 Subject: [PATCH] Ignore duplicate data directories to work around the fallout of (Fixes #3557) --- components/vfs/registerarchives.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/components/vfs/registerarchives.cpp b/components/vfs/registerarchives.cpp index b361e3f42..a22e785cd 100644 --- a/components/vfs/registerarchives.cpp +++ b/components/vfs/registerarchives.cpp @@ -1,5 +1,6 @@ #include "registerarchives.hpp" +#include #include #include @@ -33,12 +34,20 @@ namespace VFS } if (useLooseFiles) + { + std::set seen; for (Files::PathContainer::const_iterator iter = dataDirs.begin(); iter != dataDirs.end(); ++iter) { - std::cout << "Adding data directory " << iter->string() << std::endl; - // Last data dir has the highest priority - vfs->addArchive(new FileSystemArchive(iter->string())); + if (seen.insert(*iter).second) + { + std::cout << "Adding data directory " << iter->string() << std::endl; + // Last data dir has the highest priority + vfs->addArchive(new FileSystemArchive(iter->string())); + } + else + std::cerr << "Ignoring duplicate data directory " << iter->string() << std::endl; } + } vfs->buildIndex(); }