From e762267e03abf411051e5d08968858ee9e3bd106 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 29 Oct 2013 18:25:33 -0400 Subject: [PATCH] fixed screenshots for themes --- src/meta.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/meta.js b/src/meta.js index 771839e684..90e581c4bb 100644 --- a/src/meta.js +++ b/src/meta.js @@ -81,11 +81,21 @@ var utils = require('./../public/src/utils.js'), if (fs.existsSync(config)) { fs.readFile(config, function (err, file) { var configObj = JSON.parse(file.toString()); - if (!configObj.screenshot) { + if (configObj.staticDir && configObj.screenshot) { + // Verify that the provided path leads to a file that exists + fs.exists(path.join(__dirname, '../node_modules/', configObj.id, configObj.staticDir, configObj.screenshot), function(exists) { + if (exists) { + configObj.screenshot = path.join('/css/assets/', configObj.screenshot); + } else { + configObj.screenshot = nconf.get('relative_path') + '/images/themes/default.png'; + } + + next(err, configObj); + }); + } else { configObj.screenshot = nconf.get('relative_path') + '/images/themes/default.png'; + next(err, configObj); } - - next(err, configObj); }); } else { next();