Skip to content

Commit

Permalink
Deduplicate automation autoload path
Browse files Browse the repository at this point in the history
Fixes #168
Fixes arch1t3cht#15
  • Loading branch information
arch1t3cht authored and CoffeeFlux committed Dec 17, 2024
1 parent e251bc3 commit 8a90a04
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/auto4_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,14 @@ namespace Automation4 {

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

std::set<std::filesystem::path> dirnames;
for (auto tok : agi::Split(path, '|')) {
auto dirname = config::path->Decode(std::string(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 8a90a04

Please sign in to comment.