diff options
Diffstat (limited to 'tdescreensaver/kxsconfig/kxsrun.cpp')
-rw-r--r-- | tdescreensaver/kxsconfig/kxsrun.cpp | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/tdescreensaver/kxsconfig/kxsrun.cpp b/tdescreensaver/kxsconfig/kxsrun.cpp index cb9cc20b..8c144c67 100644 --- a/tdescreensaver/kxsconfig/kxsrun.cpp +++ b/tdescreensaver/kxsconfig/kxsrun.cpp @@ -88,10 +88,20 @@ int main(int argc, char *argv[]) TQPtrList<KXSConfigItem> configItemList; TQString xmlFile = "/doesntexist"; -#ifdef XSCREENSAVER_CONFIG_DIR - xmlFile = XSCREENSAVER_CONFIG_DIR; -#endif xmlFile += "/" + exeName + ".xml"; +#ifdef XSCREENSAVER_CONFIG_DIRS + TQFileInfo checkXml; + TQStringList saverConfigPaths = TQStringList::split(':', XSCREENSAVER_CONFIG_DIRS); + for (TQStringList::ConstIterator it = saverConfigPaths.begin(); it != saverConfigPaths.end(); ++it) + { + checkXml.setFile((*it) + "/" + exeName + ".xml"); + if (checkXml.exists()) + { + xmlFile = checkXml.absFilePath(); + break; + } + } +#endif if ( TQFile::exists( xmlFile ) ) { // We can use the xscreensaver xml config files. KXSXml xmlParser(0); @@ -134,16 +144,26 @@ int main(int argc, char *argv[]) // find the xscreensaver executable //work around a KStandarDirs::findExe() "feature" where it looks in $TDEDIR/bin first no matter what and sometimes finds the wrong executable - TQFileInfo checkExe; - TQString saverdir = TQString("%1/%2").arg(XSCREENSAVER_HACKS_DIR).arg(filename); - kdDebug() << "saverdir is" << saverdir << endl; TQString exeFile; - checkExe.setFile(saverdir); - if (checkExe.exists() && checkExe.isExecutable() && checkExe.isFile()) + TQFileInfo checkExe; + TQStringList saverPaths = TQStringList::split(':', XSCREENSAVER_HACKS_DIRS); + for (TQStringList::ConstIterator it = saverPaths.begin(); it != saverPaths.end(); ++it) { - exeFile = saverdir; + checkExe.setFile((*it) + "/" + filename); + if (checkExe.exists() && checkExe.isExecutable() && checkExe.isFile()) + { + exeFile = checkExe.absFilePath(); + kdDebug() << "saverdir is" << exeFile << endl; + break; + } } + if (exeFile.isEmpty()) + { + // Executable not present in XScreenSaver directory! + // Try standard paths + exeFile = TDEStandardDirs::findExe(filename); + } if (!exeFile.isEmpty()) { char *sargs[MAX_ARGS]; |