refactor to use dappPath

This commit is contained in:
Iuri Matias 2018-04-02 15:06:56 -04:00
parent 10f7d21f81
commit e0db5ed61a
5 changed files with 7 additions and 6 deletions

View File

@ -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));
});
}
});

View File

@ -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 = {

View File

@ -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));
});
}
});

View File

@ -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});
});

View File

@ -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));
});
}
});