anchor fs.dappPath, fs.embarkPath to env vars setup in cmd.js

This commit is contained in:
Michael Bradley, Jr 2018-08-17 12:37:49 -05:00
parent b7fd109237
commit 019f0b68c8
1 changed files with 14 additions and 2 deletions

View File

@ -78,11 +78,23 @@ function removeSync() {
} }
function embarkPath() { function embarkPath() {
return utils.joinPath(__dirname, '/../../', ...arguments); const _embarkPath = process.env.EMBARK_PATH;
if (!_embarkPath) {
const errMsg = 'process.env.EMBARK_PATH was not set'.bold.red;
console.error(errMsg);
process.exit(1);
}
return utils.joinPath(_embarkPath, ...arguments);
} }
function dappPath() { function dappPath() {
return utils.joinPath(utils.pwd(), ...arguments); const _dappPath = process.env.DAPP_PATH;
if (!_dappPath) {
const errMsg = 'process.env.DAPP_PATH was not set'.bold.red;
console.error(errMsg);
process.exit(1);
}
return utils.joinPath(_dappPath, ...arguments);
} }
function createWriteStream() { function createWriteStream() {