JScript code:
FileSystem.EnumerateFiles = function(Directory) {
var ret = new Array();
var result = this.FindFirstFile(Directory);
if(result.hFind === 0) {
result.WIN32_FIND_DATA.Size = 0;
return ret;
}
do {
var oResult = this.FindNextFile(result.hFind);
ret.push(oResult);
} while(oResult.hFind !== 0);
return ret;
}
That does it; I guess that using the
result object in the loop changes the references stored in the array..?