[Qt-interest] QDir Loop Problem
Aaron Lewis
aaron.lewis1989 at gmail.com
Thu Apr 8 07:26:45 CEST 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I'm trying to go through a directory , loop all of the files under it ,
but it never change to another directory
Caller will pass a absolute directory path to finder::findStringInDir.
=====================================================================================
- -snip-
QDir dir(dirName); // pass in an absolute path , some directory
check code is snipped.
QFileInfoList list = dir.entryInfoList();
for(int i=0;i<list.size();i++)
{
QFileInfo fileInfo = list.at(i);
if(fileInfo.fileName() == "." || fileInfo.fileName() == "..")
continue;
if(fileInfo.isFile())
{
findStringInFile(fileInfo.absoluteFilePath());
}
else if(fileInfo.isDir())
{
qDebug() << "Looping in : " << fileInfo.absolutePath();
findStringInDir(fileInfo.absolutePath());
}
}// for loop
- -snip-
When i launched it , my screen flooded with same debug string like this:
================================================================================================
Looping in : "/path/to/dir"
================================================================================================
Does anyone has any ideas ?
Thanks in advance !
- --
Best Regards,
Aaron Lewis - PGP: 0x4A6D32A0
FingerPrint EA63 26B2 6C52 72EA A4A5 EB6B BDFE 35B0 4A6D 32A0
irc: A4r0n on freenode
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAku9aRUACgkQvf41sEptMqAkAQCgwWV0lGpSVtgflnJc9EUp4+io
ZBYAnRvQp0su1xparGCWJrjp+DJylr/5
=bEf7
-----END PGP SIGNATURE-----
More information about the Qt-interest-old
mailing list