diff --git a/.gitignore b/.gitignore index 8d87b1d..7ba6ef2 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules/* +screenshots/* diff --git a/Makefile b/Makefile index 0f8e3c3..ffc3bf9 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,12 @@ GREP ?=. test: node_modules - @rm -rf /tmp/niffy + @rm -rf ./screenshots @node_modules/.bin/mocha --harmony --grep "$(GREP)" +clean: screenshots + @rm -rf ./screenshots + node_modules: package.json @npm install diff --git a/index.js b/index.js index 56d6eec..cbbb6c4 100644 --- a/index.js +++ b/index.js @@ -183,7 +183,15 @@ Niffy.prototype.stopProfile = function (name) { */ function imgfilepath(name, path) { - var filepath = '/tmp/niffy' + path; + + var folderExtension; + if (path === '/') { + folderExtension = 'homepage'; + } else { + folderExtension = path.substring(1); + } + + var filepath = './screenshots/' + folderExtension; if (filepath.slice(-1) !== '/') filepath += '/'; mkdirp(filepath); return (filepath + name + '.png');