Skip to content
This repository was archived by the owner on Aug 16, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules/*
screenshots/*
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
10 changes: 9 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down