Browse files

Code cleanup

  • Loading branch information...
1 parent faeed2f commit 2fc28653572dccbab3d8ee7794b1b9c754931ff0 @angelini committed Jan 12, 2012
Showing with 7 additions and 3 deletions.
  1. +7 −3 lib/resty.js
View
10 lib/resty.js
@@ -24,10 +24,14 @@ var readResources = exports._readResources = function(resource_dir) {
var level = fs.readdirSync(resource_dir);
for (; i < level.length; i++) {
- var stat = fs.statSync(path.join(resource_dir, level[i]));
+ var index = level[i];
+ var folder = path.join(resource_dir, index);
+ var file = path.join(folder, index + '.js');
+ var stat = fs.statSync(folder);
+
if (stat.isDirectory()) {
- resources[level[i]] = readResources(path.join(resource_dir, level[i]));
- resources[level[i]]._main = require(path.join(resource_dir, level[i], level[i] + '.js'));
+ resources[index] = readResources(folder);
+ resources[index]._main = require(file);
}
}

0 comments on commit 2fc2865

Please sign in to comment.