Fixed logic to prevent node exception when running command 'embark blockchain' outside the Dapp folder
This commit is contained in:
parent
0e03d8f435
commit
dd03c747f7
|
@ -23,6 +23,14 @@ Config.prototype.loadConfigFiles = function(options) {
|
||||||
if (options.interceptLogs === undefined) {
|
if (options.interceptLogs === undefined) {
|
||||||
interceptLogs = true;
|
interceptLogs = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Check if the config file exists
|
||||||
|
var embarkConfigExists = fs.existsSync(options.embarkConfig);
|
||||||
|
if(!embarkConfigExists){
|
||||||
|
this.logger.error('Cannot find file ' + options.embarkConfig + '. Please ensure you are running this command inside the Dapp folder');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
this.embarkConfig = fs.readJSONSync(options.embarkConfig);
|
this.embarkConfig = fs.readJSONSync(options.embarkConfig);
|
||||||
this.embarkConfig.plugins = this.embarkConfig.plugins || {};
|
this.embarkConfig.plugins = this.embarkConfig.plugins || {};
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,10 @@ function writeJSONSync() {
|
||||||
return fs.writeJSONSync.apply(fs.writeJSONSync, arguments);
|
return fs.writeJSONSync.apply(fs.writeJSONSync, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function existsSync(){
|
||||||
|
return fs.existsSync.apply(fs.existsSync, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
// returns embarks root directory
|
// returns embarks root directory
|
||||||
function embarkPath(fileOrDir) {
|
function embarkPath(fileOrDir) {
|
||||||
return utils.joinPath(__dirname, '/../../', fileOrDir);
|
return utils.joinPath(__dirname, '/../../', fileOrDir);
|
||||||
|
@ -37,6 +41,6 @@ module.exports = {
|
||||||
writeFileSync: writeFileSync,
|
writeFileSync: writeFileSync,
|
||||||
readJSONSync: readJSONSync,
|
readJSONSync: readJSONSync,
|
||||||
writeJSONSync: writeJSONSync,
|
writeJSONSync: writeJSONSync,
|
||||||
|
existsSync: existsSync,
|
||||||
embarkPath: embarkPath
|
embarkPath: embarkPath
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue