diff options
author | Jan Darmochwal | 2010-10-06 18:43:14 +0200 |
---|---|---|
committer | Jan Darmochwal | 2010-10-06 18:43:14 +0200 |
commit | 214caebbaba6a27b2cc848afe258ec7d14c167ce (patch) | |
tree | ee9e6e3b0dbc3b51abe3d2198fcbdb796893fb2b | |
parent | XSession init from single .desktop-file (diff) | |
download | vmchooser-214caebbaba6a27b2cc848afe258ec7d14c167ce.tar.gz vmchooser-214caebbaba6a27b2cc848afe258ec7d14c167ce.tar.xz vmchooser-214caebbaba6a27b2cc848afe258ec7d14c167ce.zip |
recursive globbing in VSession::readXmlDir()
VSession::readXmlDir() now reads .xml files in subdirectories as well
-rw-r--r-- | src/vsession.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/vsession.cpp b/src/vsession.cpp index bd86610..249594a 100644 --- a/src/vsession.cpp +++ b/src/vsession.cpp @@ -277,12 +277,16 @@ QList<Session*> VSession::readXmlDir(const QString& path) { myFilterScript.close(); } else { - // iterate over all .xml files in directory path and read them - foreach (QFileInfo fi, QDir(path).entryInfoList(QStringList("*.xml"))) { - retval.append(readXmlFile(fi.absoluteFilePath())); + // iterate over all .xml files in directory <path> (and sub-directories) + // and read them + QDirIterator di(path, + QDirIterator::Subdirectories | + QDirIterator::FollowSymlinks); + while(di.hasNext()) { + if (!di.next().endsWith(".xml")) continue; + retval.append(readXmlFile(di.fileInfo().absoluteFilePath())); } } - return retval; } |