This the code block that does the path loading:
https://github.com/hyperion-pr…e/EffectEngine.cpp#L34-53
Will add a check there so if we found 0 valid paths it throws an error
// Update
Would look like this and will test here now, so if we find 0 paths it will always throw and if only one out of two in there is invalid we don't throw as we have valid effects.
// read all effects
bool effectPathIsValid;
const Json::Value & paths = jsonEffectConfig["paths"];
for (Json::UInt i = 0; i < paths.size(); ++i)
{
const std::string & path = paths[i].asString();
QDir directory(QString::fromStdString(path));
if (!directory.exists())
{
continue;
}
effectPathIsValid = true;
QStringList filenames = directory.entryList(QStringList() << "*.json", QDir::Files, QDir::Name | QDir::IgnoreCase);
foreach (const QString & filename, filenames)
{
EffectDefinition def;
if (loadEffectDefinition(path, filename.toStdString(), def))
{
_availableEffects.push_back(def);
}
}
}
if(!effectPathIsValid)
{
std::cerr << "EFFECTENGINE ERROR: no usuable effect directories were found" << std::endl;
}
Alles anzeigen
// Update 2
Complete example on gist and tested here with one invalid and one valid path like in the example.
\libsrc\effectengine\EffectEngine.cpp
[MEDIA=gist]RickDB/3e8938b86f6bc3b0da076824c14574e7[/MEDIA]