From 7e3b06ea7ab092ffb9fb75d94fefc5f31a6925b7 Mon Sep 17 00:00:00 2001 From: cainus Date: Thu, 28 Mar 2013 00:39:20 -0700 Subject: fix pathing issues? --- lib/convertLcovToCoveralls.js | 12 ++++-------- package.json | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/convertLcovToCoveralls.js b/lib/convertLcovToCoveralls.js index dfc467c..c390aab 100644 --- a/lib/convertLcovToCoveralls.js +++ b/lib/convertLcovToCoveralls.js @@ -1,6 +1,7 @@ var TRAVIS_JOB_ID = process.env.TRAVIS_JOB_ID || 'unknown'; var fs = require('fs'); var lcovParse = require('./parser'); +var path = require('path'); var detailsToCoverage = function(length, details){ var coverage = new Array(length); @@ -11,8 +12,8 @@ var detailsToCoverage = function(length, details){ }; var convertLcovFileObject = function(file, filepath){ - var path = filepath + "/" + file.file; - var source = fs.readFileSync(path, 'utf8'); + var fullpath = path.join(filepath, file.file); + var source = fs.readFileSync(fullpath, 'utf8'); var lines = source.split("\n"); var coverage = detailsToCoverage(lines.length, file.lines.details); return { name : file.file, @@ -23,13 +24,8 @@ var convertLcovFileObject = function(file, filepath){ var convertLcovToCoveralls = function(input, filepath){ console.log("in: ", filepath); if (filepath[0] !== '/'){ - filepath = process.cwd() + '/' + filepath; + filepath = path.join(process.cwd(), filepath); } - console.log("now: ", filepath); - if (filepath[filepath.length - 1] !== '/'){ - filepath = filepath + '/'; - } - console.log("abs: ", filepath); var parsed = lcovParse(input); var postJson = { service_job_id : TRAVIS_JOB_ID, diff --git a/package.json b/package.json index 01fcaed..8c36330 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "coveralls", "description" : "takes json-cov output into stdin and POSTs to coveralls.io", "keywords" : ["coverage", "coveralls"], - "version": "2.0.1", + "version": "2.0.2", "bugs": { "url": "https://github.com/cainus/node-coveralls/issues" }, -- cgit v1.2.3