code: function getPath(filename, dir) {
    if (dir) {
      fs.ensureDirSync(dir);
      return filePath.join(dir, filename);
    } else {
      return filePath.join(__dirname, filename);
    }
  }
docs: Function: getPath
  Returns the path to the given file based on passed directory.
  
  Parameters:
  (String) filename - Filename
  (String) (optional) dir - directory to look for given file