From 8a86dc777a06169aebde87eee2762fa93b042534 Mon Sep 17 00:00:00 2001 From: Dan Phifer Date: Mon, 25 Sep 2017 15:12:28 +0800 Subject: [PATCH] Bug fix for windows file paths --- lib/app.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/app.js b/lib/app.js index c467553..68ddd28 100644 --- a/lib/app.js +++ b/lib/app.js @@ -8,6 +8,8 @@ const getInstrumentedVersion = require('./instrumentSolidity.js'); const CoverageMap = require('./coverageMap.js'); const defaultTruffleConfig = require('./truffleConfig.js'); +const isWin = /^win/.test(process.platform); + const gasLimitHex = 0xfffffffffff; // High gas block limit / contract deployment limit const gasPriceHex = 0x01; // Low gas price @@ -111,7 +113,9 @@ class App { this.log('Instrumenting ', file); currentFile = file; - const contractPath = path.resolve(file); + const contractPath = isWin + ? path.resolve(file).split('\\').join('/') + : path.resolve(file); const working = this.workingDir.substring(1); const canonicalPath = contractPath.split('/coverageEnv').join(working); const contract = fs.readFileSync(contractPath).toString();