Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

nsIFile.directoryEntries.hasMoreElements - Endless Loop

4 views
Skip to first unread message

James Newell

unread,
Apr 4, 2007, 9:15:28 AM4/4/07
to
Hi.
I am having a problem on Xulrunner 1.9a4 with
nsIFile.directoryEntries.hasMoreElements. It returns true leaving my
app in an endless loop, getNext returning the same file object again
and again.

Am calling it through JS and OS is WinXP.

Anyone else get this problem?

Thanks,
James

var subFile;
var file = Components.classes["@mozilla.org/file/local;
1"].createInstance(Components.interfaces.nsILocalFile);
file.initWithPath("C:\\");

while(file.directoryEntries.hasMoreElements()) {

subFile = file.directoryEntries.getNext();
subFile.QueryInterface(Components.interfaces.nsIFile);

dump(subFile.path + "\n");

}

Gives:

C:\AUTOEXEC.BAT
C:\AUTOEXEC.BAT
C:\AUTOEXEC.BAT
C:\AUTOEXEC.BAT
...

0 new messages