diff options
Diffstat (limited to 'lib/courseware.js')
-rw-r--r-- | lib/courseware.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/courseware.js b/lib/courseware.js index b3faaf4..2431284 100644 --- a/lib/courseware.js +++ b/lib/courseware.js @@ -13,7 +13,8 @@ var fs = require('fs'), colors = require('colors'), _ = require('lodash'); -var camo = { 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36' }; +var isWin = /^win/.test(process.platform), + camo = { 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36' }; function saveData(argv, details, data) { @@ -21,7 +22,7 @@ function saveData(argv, details, data) { details = details.map(function items(item) { return item.replace(/[^a-z0-9]/gi, '_').replace(/(_){2,}/g, '_'); }); - fs.writeFile(argv.d + details[0] + '-' + details[1] + '.txt', data.join('\n'), function (err) { + fs.writeFile(argv.d + details[0] + '-' + details[1] + '.txt', data.join((!isWin) ? '\n' : '\r\n'), function (err) { if (err !== null) { return console.log(err.stack); } }); } |