makes a directory path in the filesystem
function makePath(dirPath) {
    dirPath = path.dirname(dirPath).split(path.sep)
    dirPath.reduce(function(dirPath, p) {
        dirPath = path.join(dirPath, p)
        if (! fs.existsSync(dirPath)) {
            try {
                fs.mkdirSync(dirPath)
            } catch (e) {
                throw 'Could not make path ' + dirPath
            }
        }
        return dirPath
    }, '')
}