use embark config to get contracts dir

This commit is contained in:
Jonathan Rainville 2018-10-17 15:08:36 -04:00 committed by Pascal Precht
parent a65bbabd15
commit cc88b846aa
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 3 additions and 1 deletions

View File

@ -13,7 +13,9 @@ class ScaffoldingSolidity {
_generateFile(contract, templateFilename, extension, data, overwrite){ _generateFile(contract, templateFilename, extension, data, overwrite){
const filename = capitalize(contract.className.toLowerCase()) + '.' + extension; const filename = capitalize(contract.className.toLowerCase()) + '.' + extension;
const filePath = './contracts/' + filename; const contractDirs = this.embark.config.embarkConfig.contracts;
const contractDir = Array.isArray(contractDirs) ? contractDirs[0] : contractDirs;
const filePath = fs.dappPath(contractDir.replace(/\*/g, ''), filename);
if (!overwrite && fs.existsSync(filePath)){ if (!overwrite && fs.existsSync(filePath)){
throw new Error("file '" + filePath + "' already exists"); throw new Error("file '" + filePath + "' already exists");
} }