- Code: Select all
if (c.isDirectory) {
var l = c.list()
for (var idx in l) {
var cPath = l[idx];
Plugin.collectPlugins(cPath)
}
}
According to the docs on the File object, the list() method returns an array containing all the files found, and each file will be listed twice, once by numeric iterator, and once by named iterator.
To only receive one instance of each file listed, just use one iteration method or the other. But, if you use the "for(var idx in l)" technique then you will be using both iteration methods, and will receive two of each listed file.
An easy fix for this in the above code would be:
- Code: Select all
if (c.isDirectory) {
var l = c.list()
for (var idx=0; idx<l.length; idx++) { // this line changed
var cPath = l[idx];
Plugin.collectPlugins(cPath)
}
}


