diff --git a/src/auto4_base.cpp b/src/auto4_base.cpp index ff9615c90a..e12f2ef928 100644 --- a/src/auto4_base.cpp +++ b/src/auto4_base.cpp @@ -316,11 +316,14 @@ namespace Automation4 { std::vector>> script_futures; - auto path_it = agi::Split(path, '|'); - for (auto tok : std::set(begin(path_it), end(path_it))) { + std::set dirnames; + for (auto tok : agi::Split(path, '|')) { auto dirname = config::path->Decode(agi::str(tok)); if (!agi::fs::DirectoryExists(dirname)) continue; + if (dirnames.count(dirname)) continue; + dirnames.insert(dirname); + for (auto filename : agi::fs::DirectoryIterator(dirname, "*.*")) script_futures.emplace_back(std::async(std::launch::async, [=] { return ScriptFactory::CreateFromFile(dirname/filename, false, false);