add filename to compiler hash

This commit is contained in:
Iuri Matias 2016-02-09 14:44:40 -05:00
parent 991abb2c7d
commit 3ec1fdb6d9
1 changed files with 5 additions and 3 deletions

View File

@ -15,13 +15,15 @@ Compiler.prototype.init = function(env) {
Compiler.prototype.compile_solidity = function(contractFiles) { Compiler.prototype.compile_solidity = function(contractFiles) {
var input = {} var input = {}
for (var i = 0; i < contractFiles.length; i++){ for (var i = 0; i < contractFiles.length; i++){
input[contractFiles[i].substring(14)] = fs.readFileSync(contractFiles[i]).toString(); //console.log(contractFiles[i]);
//input[contractFiles[i].substring(14)] = fs.readFileSync(contractFiles[i]).toString();
input[contractFiles[i].split('/')[3]] = fs.readFileSync(contractFiles[i]).toString();
} }
var output = solc.compile({sources: input}, 1); var output = solc.compile({sources: input}, 1);
if (output.errors) if (output.errors)
throw new Error ("Solidity errors: " + output.errors) throw new Error ("Solidity errors: " + output.errors)