The following test code shows an inconsistency when a reuseable DOpus.FSUtil object is used to read another collection after reading a first collection. The first and second collections can be the same or different. The two highlighted results show folderenum.error = 18 instead of an expected folderenum.error = 0. This does not happen when the input to ReadDir is a regular folder and it does not happen when using a new FSUtil object. It is also worth noting that ss.assign(folderenum.Next(-1)) works correctly even though folderenum.error is not equal to zero.
I stumbled across this in my real code because I was testing for folderenum.error = 0 and using a pre-defined FSUtil object. It took me a while to work out what was happening. Using a new FSUtil object addresses the issue as does ignoring the non zero error.
function OnClick(clickData)
{
// --------------------------------------------------------
DOpus.ClearOutput();
// --------------------------------------------------------
var fsu = DOpus.FSUtil(); // Reuseable FSUtil object
// --------------------------------------------------------
readdir("C:/");
readdir("C:/");
readdir("C:/",fsu); // Use reuseable FSUtil
readdir("C:/",fsu);
readdir("coll://Find Results");
readdir("coll://Find Results");
readdir("coll://Marked Pictures");
readdir("coll://Find Results",fsu); // Use reuseable FSUtil
readdir("coll://Find Results",fsu);
readdir("coll://Marked Pictures",fsu);
return;
// --------------------------------------------------------
}
function readdir(dir,fsu)
{
var ss = DOpus.Create().StringSet();
var folderenum = (fsu==undefined) ? DOpus.FSUtil.ReadDir(dir) : fsu.ReadDir(dir);
DOpus.output(dir+", folderenum.error = "+folderenum.error+", folderenum.complete = "+folderenum.complete);
ss.assign(folderenum.Next(-1));
DOpus.output(dir+", folderenum.error = "+folderenum.error+", folderenum.complete = "+folderenum.complete+", ss.count = "+ss.count);
}