pass the current file path to 'deployMetadataOf'

pull/178/head
yann300 4 years ago
parent c547c45dd2
commit 3fd42b3bcd
  1. 12
      apps/remix-ide/src/app/files/compiler-metadata.js
  2. 2
      apps/remix-ide/src/app/tabs/runTab/contractDropdown.js

@ -90,10 +90,18 @@ class CompilerMetadata extends Plugin {
} }
// TODO: is only called by dropdownLogic and can be moved there // TODO: is only called by dropdownLogic and can be moved there
deployMetadataOf (contractName) { deployMetadataOf (contractName, fileLocation) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
var provider = this.fileManager.currentFileProvider() var provider = this.fileManager.currentFileProvider()
var path = this.fileManager.currentPath() let path
if (fileLocation) {
path = fileLocation.split('/')
path.pop()
path = path.join('/')
} else {
path = this.fileManager.currentPath()
}
if (provider && path) { if (provider && path) {
this.blockchain.detectNetwork((err, { id, name } = {}) => { this.blockchain.detectNetwork((err, { id, name } = {}) => {
if (err) { if (err) {

@ -249,7 +249,7 @@ class ContractDropdownUI {
let contractMetadata let contractMetadata
try { try {
contractMetadata = await this.runView.call('compilerMetadata', 'deployMetadataOf', selectedContract.name) contractMetadata = await this.runView.call('compilerMetadata', 'deployMetadataOf', selectedContract.name, selectedContract.contract.file)
} catch (error) { } catch (error) {
return statusCb(`creation of ${selectedContract.name} errored: ` + (error.message ? error.message : error)) return statusCb(`creation of ${selectedContract.name} errored: ` + (error.message ? error.message : error))
} }

Loading…
Cancel
Save