From edae6535845c17ea121f05a9fd2693e1ab025773 Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Sun, 17 Sep 2023 18:47:42 +0200 Subject: [PATCH] Deduplicate automation autoload path, for real this time Replaces the incorrect fix in 642251b Fixes arch1t3cht/Aegisub#15 --- src/auto4_base.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/auto4_base.cpp b/src/auto4_base.cpp index 0b9c292bd..238ceae53 100644 --- a/src/auto4_base.cpp +++ b/src/auto4_base.cpp @@ -315,11 +315,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);