var fs = require('fs');

var settings = require('../../../settings.js');

module.exports = function (options, cb) {
    fs.readdir(settings.dataDir + '/forms', function (err, files) {
        if (err) return cb(err);
        var urls = [];
        for (var i = 0; i < files.length; i++) {
            var f = files[i];
            if (f.indexOf('.xml') === -1) continue; // Needs to be XML
            urls.push(options.baseUrl + '/' + f);
        }
        cb(null, urls);
    });
};

@@ -16,16 +16,44 @@
 e('fs');
+%0Avar path = require('path');
 %0A%0Avar se
@@ -141,16 +141,23 @@
 ) %7B%0A    
+return 
 fs.readd
@@ -228,16 +228,28 @@
 if (err)
+ %7B%0A         
  return 
@@ -269,195 +269,189 @@
     
-var urls = %5B%5D;%0A        for (var i = 0; i %3C files.length; i++) %7B%0A            var f = files%5Bi%5D;%0A            if (f.indexOf('.xml') === -1) continue; // Needs to be XML%0A            urls.push(
+%7D%0A%0A        var urls = files%0A          .filter(f =%3E f.indexOf('.xml') %3E= 0)%0A          .filter(f =%3E fs.statSync(path.join(settings.dataDir, 'forms', f)).size %3E 0)%0A          .map(f =%3E 
 opti
@@ -474,25 +474,16 @@
 ' + f);%0A
-        %7D
 %0A       
@@ -483,16 +483,23 @@
         
+return 
 cb(null,

Refactor URL generation