From d3606eac99ed82426cd389cfea32ed5ddfc8144b Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Thu, 7 Feb 2013 15:58:51 -0800 Subject: [PATCH] Don't complain about things in the autoload folder which aren't automation scripts --- aegisub/src/auto4_base.cpp | 8 ++++---- aegisub/src/auto4_base.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/aegisub/src/auto4_base.cpp b/aegisub/src/auto4_base.cpp index da8b18360..f141cf3a3 100644 --- a/aegisub/src/auto4_base.cpp +++ b/aegisub/src/auto4_base.cpp @@ -358,7 +358,7 @@ namespace Automation4 { if (!agi::fs::DirectoryExists(dirname)) continue; for (auto filename : agi::fs::DirectoryIterator(dirname, "*.*")) { - Script *s = ScriptFactory::CreateFromFile(dirname/filename, true); + Script *s = ScriptFactory::CreateFromFile(dirname/filename, false, false); if (s) { scripts.push_back(s); if (!s->GetLoadedState()) ++error_count; @@ -480,19 +480,19 @@ namespace Automation4 { } } - Script* ScriptFactory::CreateFromFile(agi::fs::path const& filename, bool log_errors, bool create_unknown) + Script* ScriptFactory::CreateFromFile(agi::fs::path const& filename, bool complain_about_unrecognised, bool create_unknown) { for (auto factory : Factories()) { Script *s = factory->Produce(filename); if (s) { - if (!s->GetLoadedState() && log_errors) { + if (!s->GetLoadedState()) { wxLogError(_("An Automation script failed to load. File name: '%s', error reported: %s"), filename.wstring(), s->GetDescription()); } return s; } } - if (log_errors) { + if (complain_about_unrecognised) { wxLogError(_("The file was not recognised as an Automation script: %s"), filename.wstring()); } diff --git a/aegisub/src/auto4_base.h b/aegisub/src/auto4_base.h index 42cf2dad1..afd5897d0 100644 --- a/aegisub/src/auto4_base.h +++ b/aegisub/src/auto4_base.h @@ -274,9 +274,9 @@ namespace Automation4 { /// Load a script from a file /// @param filename Script to load - /// @param log_errors Should load errors be displayed? + /// @param complain_about_unrecognised Should an error be displayed for files that aren't automation scripts? /// @param create_unknown Create a placeholder rather than returning nullptr if no script engine supports the file - static Script* CreateFromFile(agi::fs::path const& filename, bool log_errors, bool create_unknown=true); + static Script* CreateFromFile(agi::fs::path const& filename, bool complain_about_unrecognised, bool create_unknown=true); static const std::vector& GetFactories(); };