Fix error in package structure of scripted effects

The Plasma package structure contains a subdirectory "contents".
Furthermore we have to use locate instead of locateLocal to find
system wide installed packages and adding some debug output for
the case that the script cannot be found.
This commit is contained in:
Martin Gräßlin 2012-02-02 14:34:59 +01:00
parent 8175278526
commit 048540a7c5
2 changed files with 4 additions and 2 deletions

View file

@ -1236,13 +1236,14 @@ bool EffectsHandlerImpl::loadScriptedEffect(const QString& name, KService *servi
kDebug(1212) << "X-Plasma-MainScript not set";
return false;
}
const QString scriptFile = KStandardDirs::locateLocal("data", "kwin/effects/" + name + '/' + scriptName);
const QString scriptFile = KStandardDirs::locate("data", "kwin/effects/" + name + "/contents/" + scriptName);
if (scriptFile.isNull()) {
kDebug(1212) << "Could not locate the effect script";
return false;
}
ScriptedEffect *effect = ScriptedEffect::create(name, scriptFile);
if (!effect) {
kDebug(1212) << "Could not initialize scripted effect: " << name;
return false;
}
effect_order.insert(service->property("X-KDE-Ordering").toInt(), EffectPair(name, effect));

View file

@ -138,6 +138,7 @@ bool ScriptedEffect::init(const QString &effectName, const QString &pathToScript
{
QFile scriptFile(pathToScript);
if (!scriptFile.open(QIODevice::ReadOnly)) {
kDebug(1212) << "Could not open script file: " << pathToScript;
return false;
}
m_effectName = effectName;
@ -245,7 +246,7 @@ QVariant ScriptedEffect::readConfig(const QString& key)
bool ScriptedEffect::loadConfig(const QString& name)
{
const QString path = KStandardDirs::locateLocal("data", "kwin/effects/" + m_effectName + "/config/" + name + ".xml");
const QString path = KStandardDirs::locate("data", "kwin/effects/" + m_effectName + "/contents/config/" + name + ".xml");
if (path.isEmpty()) {
return false;
}