From 507ad9457315616923e749676b4d60a4cb5db44c Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Fri, 19 Jun 2020 11:22:43 +0100 Subject: [PATCH] Trigger add folder event --- apps/remix-ide/src/app/files/remixDProvider.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/files/remixDProvider.js b/apps/remix-ide/src/app/files/remixDProvider.js index 09f201a10b..45ee1f2130 100644 --- a/apps/remix-ide/src/app/files/remixDProvider.js +++ b/apps/remix-ide/src/app/files/remixDProvider.js @@ -24,7 +24,7 @@ module.exports = class RemixDProvider { this._appManager.on('remixd', 'folderAdded', (path) => { console.log('event listener called') - this.event.trigger('folderAdded', [path]) + this.event.trigger('folderAdded', [this.addPrefix(path)]) }) this._appManager.on('remixd', 'notified', (data) => { @@ -182,11 +182,18 @@ module.exports = class RemixDProvider { return path } + addPrefix (path) { + if (path.indexOf(this.type + '/') === 0) return path + if (path[0] === '/') return 'localhost' + path + return 'localhost/' + path + } + resolveDirectory (path, callback) { var self = this if (path[0] === '/') path = path.substring(1) if (!path) return callback(null, { [self.type]: { } }) const unprefixedpath = this.removePrefix(path) + console.log('unprefixedpath: ', unprefixedpath) this._appManager.call('remixd', 'resolveDirectory', { path: unprefixedpath }).then((result) => { callback(null, result) }).catch(callback)