From e0ab9cbde406d676f9811d86e0daf4fc72eebd4f Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Thu, 12 Apr 2018 17:57:55 -0400 Subject: [PATCH] refactor findImports --- lib/modules/solidity/solcP.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/modules/solidity/solcP.js b/lib/modules/solidity/solcP.js index e4d04cab5..2922c088f 100644 --- a/lib/modules/solidity/solcP.js +++ b/lib/modules/solidity/solcP.js @@ -4,15 +4,13 @@ let fs = require('fs-extra'); let path = require('path'); function findImports(filename) { - console.dir(filename); - if (!fs.existsSync(filename)) { - if (fs.existsSync(path.join('./node_modules/', filename))) { - return {contents: fs.readFileSync(path.join('./node_modules/', filename)).toString()}; - } else { - return {error: 'File not found'}; - } + if (fs.existsSync(filename)) { + return {contents: fs.readFileSync(filename).toString()}; } - return {contents: fs.readFileSync(filename).toString()}; + if (fs.existsSync(path.join('./node_modules/', filename))) { + return {contents: fs.readFileSync(path.join('./node_modules/', filename)).toString()}; + } + return {error: 'File not found'}; } process.on('message', function (msg) {