From 623d5ec42150b761cb7b3b56c7b7b9eaaf5c1e23 Mon Sep 17 00:00:00 2001 From: Benjamin Kiessling Date: Mon, 23 Jan 2012 15:38:57 +0100 Subject: More unambiguous names in configuration --- model_fs.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'model_fs.js') diff --git a/model_fs.js b/model_fs.js index 1a36986..de2f56f 100644 --- a/model_fs.js +++ b/model_fs.js @@ -21,24 +21,23 @@ exports.start = function(config) { exports.rebuildFiles = function() { - walker = walk.walk(configuration.dir, { followLinks: false }); + console.log('rebuilding...'); + walker = walk.walk(configuration.rootDir, { followLinks: false }); var newSlides = {}; walker.on("directories", function (root, dirAr, next) { var lastDir = path.join(__dirname, root).split('/'); if((lastDir.length - __dirname.split('/').length) < 2) { dirAr.forEach(function(dir) { - newSlides[dir.name] = { name: dir.name, template: - path.join(configuration.defaultSlides, - configuration.template) , slides: []}; + newSlides[dir.name] = { name: dir.name, template: '', slides: []}; }); } next(); }).on("file", function(root, fileStats, next) { - if(fileStats.name == configuration.description || fileStats.name == configuration.events) { + if(fileStats.name == configuration.descriptionFile || fileStats.name == configuration.eventFile) { next(); } - else if(fileStats.name == configuration.template) { + else if(fileStats.name == configuration.templateFile) { var lastDir = root.split('/'); newSlides[lastDir[lastDir.length - 1]]['template'] = path.join(lastDir[lastDir.length - 1], fileStats.name); next(); @@ -65,7 +64,7 @@ exports.rebuildFiles = function() { for(var slideset in newSlides) { /* collects descriptions and adds them to the slideset */ var collectDescs = function(slideset) { - fs.readFile(path.join(__dirname, configuration.dir, slideset, configuration.description), function(err, data) { + fs.readFile(path.join(__dirname, configuration.rootDir, slideset, configuration.descriptionFile), function(err, data) { if(err) { setSlides(slideset, newSlides[slideset], function(err) { if(err) { throw err}}); return; } var descs = JSON.parse(data.toString()); for(var file in newSlides[slideset]['slides']) { @@ -85,7 +84,7 @@ exports.rebuildFiles = function() { } /* collect events and adds them to the slideset */ var collectEvents = function(slideset) { - fs.readFile(path.join(__dirname, configuration.dir, slideset, configuration.events), function(err, data) { + fs.readFile(path.join(__dirname, configuration.rootDir, slideset, configuration.eventFile), function(err, data) { if(err) { return; } try { var events = JSON.parse(data.toString()); -- cgit v1.2.1