Skip to content

Commit

Permalink
Deduplicate automation autoload path, for real this time
Browse files Browse the repository at this point in the history
Replaces the incorrect fix in 642251b
Fixes #15
  • Loading branch information
arch1t3cht committed Sep 17, 2023
1 parent 4f67db8 commit edae653
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/auto4_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,14 @@ namespace Automation4 {

std::vector<std::future<std::unique_ptr<Script>>> script_futures;

auto path_it = agi::Split(path, '|');
for (auto tok : std::set<agi::StringRange>(begin(path_it), end(path_it))) {
std::set<agi::fs::path> 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);
Expand Down

0 comments on commit edae653

Please sign in to comment.