Skip to content

Commit

Permalink
Use __dirname to read 'pragmaticprogrammer.txt'
Browse files Browse the repository at this point in the history
This should fix sfrapoport#1. Uses the [__dirname](https://nodejs.org/docs/latest/api/globals.html#globals_dirname) of the package to read local data files.

Use `path.join` to combine the two, this gives some free cross-platform support :)
  • Loading branch information
mshenfield committed Jan 4, 2016
1 parent f65f8e0 commit ba14772
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#! /usr/bin/env node
var fs = require('fs');
var path = require('path');
var args = process.argv.slice(2);

var tips = fs.readFileSync('./pragmaticprogrammer.txt');
var tips = fs.readFileSync(path.join(__dirname, 'pragmaticprogrammer.txt'));
var tipList = tips.toString().split('\n');

try {
Expand Down

0 comments on commit ba14772

Please sign in to comment.