diff --git a/lib/contracts/code_generator.js b/lib/contracts/code_generator.js index 3ad9c920c..0a27d06ab 100644 --- a/lib/contracts/code_generator.js +++ b/lib/contracts/code_generator.js @@ -284,7 +284,7 @@ class CodeGenerator { return next(null, utils.joinPath(fs.embarkPath("js/web3-1.0.min.js"))); } else { self.events.request("version:getPackageLocation", "web3", web3Version, function(err, location) { - return next(null, utils.joinPath(utils.pwd(), location)); + return next(null, fs.dappPath(location)); }); } }); diff --git a/lib/core/fs.js b/lib/core/fs.js index 66c2ee860..7ce3516ad 100644 --- a/lib/core/fs.js +++ b/lib/core/fs.js @@ -50,8 +50,8 @@ function embarkPath(fileOrDir) { return utils.joinPath(__dirname, '/../../', fileOrDir); } -function dappPath() { - return utils.pwd(); +function dappPath(path) { + return utils.joinPath(utils.pwd(), path || ""); } module.exports = { diff --git a/lib/modules/ipfs/index.js b/lib/modules/ipfs/index.js index 7051c2518..e433be6d3 100644 --- a/lib/modules/ipfs/index.js +++ b/lib/modules/ipfs/index.js @@ -84,7 +84,7 @@ class IPFS { let currentIpfsApiVersion = require('../../../package.json').dependencies["ipfs-api"]; if (ipfsApiVersion !== currentIpfsApiVersion) { self.events.request("version:getPackageLocation", "ipfs-api", ipfsApiVersion, function(err, location) { - self.embark.registerImportFile("ipfs-api", utils.joinPath(utils.pwd(), location)); + self.embark.registerImportFile("ipfs-api", fs.dappPath(location)); }); } }); diff --git a/lib/modules/solidity/solcW.js b/lib/modules/solidity/solcW.js index 55d2ab38b..70a434336 100644 --- a/lib/modules/solidity/solcW.js +++ b/lib/modules/solidity/solcW.js @@ -1,4 +1,5 @@ let utils = require('../../utils/utils.js'); +let fs = require('../../core/fs.js'); let solcProcess; let compilerLoaded = false; let currentSolcVersion = require('../../../package.json').dependencies.solc; @@ -32,7 +33,7 @@ class SolcW { if (err) { return done(err); } - let requirePath = utils.joinPath(utils.pwd(), location); + let requirePath = fs.dappPath(location); solcProcess.send({action: 'loadCompiler', solcLocation: requirePath}); }); diff --git a/lib/pipeline/pipeline.js b/lib/pipeline/pipeline.js index 770e63269..e644bff8f 100644 --- a/lib/pipeline/pipeline.js +++ b/lib/pipeline/pipeline.js @@ -285,7 +285,7 @@ class Pipeline { return next(null, utils.joinPath(fs.embarkPath("js/web3-1.0.min.js"))); } else { self.events.request("version:getPackageLocation", "web3", web3Version, function(err, location) { - return next(null, utils.joinPath(utils.pwd(), location)); + return next(null, fs.dappPath(location)); }); } });