use embark config to get contracts dir
This commit is contained in:
parent
a65bbabd15
commit
cc88b846aa
|
@ -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");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue