aboutsummaryrefslogtreecommitdiffstats
path: root/RPCTests/modules/utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'RPCTests/modules/utils.js')
-rw-r--r--RPCTests/modules/utils.js21
1 files changed, 18 insertions, 3 deletions
diff --git a/RPCTests/modules/utils.js b/RPCTests/modules/utils.js
index 24e9bd811..5d32ec771 100644
--- a/RPCTests/modules/utils.js
+++ b/RPCTests/modules/utils.js
@@ -45,19 +45,34 @@ module.exports = {
fs.writeFile(path, data, (err) => { if (err) throw err;});
},
- listFiles: function listFiles(dir) {
+ listFiles: function listFiles(dir, recursive = false) {
var results = [];
fs.readdirSync(dir).forEach(function(file) {
file = dir+'/'+file;
var stat = fs.statSync(file);
- if (stat && stat.isDirectory()) {
- results = results.concat(listFiles(file))
+ if (stat && stat.isDirectory() && recursive) {
+ results = results.concat(listFiles(file, recursive))
} else results.push(file);
});
return results;
+ },
+
+ listFolders: function listFolders(dir) {
+
+ var results = [];
+ fs.readdirSync(dir).forEach(function(file) {
+ file = dir+'/'+file;
+ var stat = fs.statSync(file);
+
+ if (stat && stat.isDirectory()) {
+ results.push(file);
+ }
+ });
+
+ return results;
}
} //exports