mirror of https://github.com/odrling/Aegisub
Don't complain about things in the autoload folder which aren't automation scripts
This commit is contained in:
parent
a872fc50b8
commit
d3606eac99
|
@ -358,7 +358,7 @@ namespace Automation4 {
|
||||||
if (!agi::fs::DirectoryExists(dirname)) continue;
|
if (!agi::fs::DirectoryExists(dirname)) continue;
|
||||||
|
|
||||||
for (auto filename : agi::fs::DirectoryIterator(dirname, "*.*")) {
|
for (auto filename : agi::fs::DirectoryIterator(dirname, "*.*")) {
|
||||||
Script *s = ScriptFactory::CreateFromFile(dirname/filename, true);
|
Script *s = ScriptFactory::CreateFromFile(dirname/filename, false, false);
|
||||||
if (s) {
|
if (s) {
|
||||||
scripts.push_back(s);
|
scripts.push_back(s);
|
||||||
if (!s->GetLoadedState()) ++error_count;
|
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()) {
|
for (auto factory : Factories()) {
|
||||||
Script *s = factory->Produce(filename);
|
Script *s = factory->Produce(filename);
|
||||||
if (s) {
|
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());
|
wxLogError(_("An Automation script failed to load. File name: '%s', error reported: %s"), filename.wstring(), s->GetDescription());
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (log_errors) {
|
if (complain_about_unrecognised) {
|
||||||
wxLogError(_("The file was not recognised as an Automation script: %s"), filename.wstring());
|
wxLogError(_("The file was not recognised as an Automation script: %s"), filename.wstring());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -274,9 +274,9 @@ namespace Automation4 {
|
||||||
|
|
||||||
/// Load a script from a file
|
/// Load a script from a file
|
||||||
/// @param filename Script to load
|
/// @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
|
/// @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<ScriptFactory*>& GetFactories();
|
static const std::vector<ScriptFactory*>& GetFactories();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue