Unverified Commit b7068d35 authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #947 from ethereum/fixRemixdWorkspace

Fix importing file using localhost
parents cb673996 982da81a
...@@ -91,7 +91,7 @@ module.exports = { ...@@ -91,7 +91,7 @@ module.exports = {
.executeScript('remix.execute(\'resolveExternalUrlAndSave.js\')') .executeScript('remix.execute(\'resolveExternalUrlAndSave.js\')')
.pause(6000) .pause(6000)
.journalLastChildIncludes('Implementation of the {IERC20} interface.') .journalLastChildIncludes('Implementation of the {IERC20} interface.')
.openFile('github/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol') .openFile('.deps/github/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol')
}, },
'Call Remix File Resolver (internal URL) from a script': function (browser: NightwatchBrowser) { 'Call Remix File Resolver (internal URL) from a script': function (browser: NightwatchBrowser) {
...@@ -114,7 +114,7 @@ module.exports = { ...@@ -114,7 +114,7 @@ module.exports = {
.executeScript('remix.execute(\'resolveExternalUrlAndSaveToaPath.js\')') .executeScript('remix.execute(\'resolveExternalUrlAndSaveToaPath.js\')')
.pause(6000) .pause(6000)
.journalLastChildIncludes('abstract contract ERC20Burnable') .journalLastChildIncludes('abstract contract ERC20Burnable')
.openFile('github/newFile.sol') .openFile('.deps/github/newFile.sol')
.end() .end()
}, },
......
...@@ -88,9 +88,9 @@ module.exports = class CompilerImports extends Plugin { ...@@ -88,9 +88,9 @@ module.exports = class CompilerImports extends Plugin {
(error, content, cleanUrl, type, url) => { (error, content, cleanUrl, type, url) => {
if (error) return cb(error) if (error) return cb(error)
if (this.fileManager) { if (this.fileManager) {
const workspace = this.fileManager.getProvider('workspace') const provider = this.fileManager.currentFileProvider()
const path = targetPath || type + '/' + cleanUrl const path = targetPath || type + '/' + cleanUrl
if (workspace) workspace.addExternal(path, content, url) if (provider) provider.addExternal('.deps/' + path, content, url)
} }
cb(null, content) cb(null, content)
}) })
......
'use strict' 'use strict'
var EventManager = require('../../lib/events') const FileProvider = require('./fileProvider')
module.exports = class RemixDProvider { module.exports = class RemixDProvider extends FileProvider {
constructor (appManager) { constructor (appManager) {
this.event = new EventManager() super('localhost')
this._appManager = appManager this._appManager = appManager
this.type = 'localhost'
this.error = { EEXIST: 'File already exists' } this.error = { EEXIST: 'File already exists' }
this._isReady = false this._isReady = false
this._readOnlyFiles = {} this._readOnlyFiles = {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment