From 0de5bfb1b3f2726b84da8b9f3646a71e83cf9939 Mon Sep 17 00:00:00 2001 From: przemyslawpluta Date: Sat, 26 Apr 2014 19:59:29 +0100 Subject: win typo fix --- lib/courseware.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/courseware.js') 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); } }); } -- cgit v1.2.3