pull/5370/head
yann300 4 years ago
parent b4157f6f1b
commit 92d8835484
  1. 2
      apps/remix-ide/src/app/files/fileProvider.js
  2. 4
      apps/remix-ide/src/app/files/workspaceFileProvider.js

@ -200,7 +200,7 @@ class FileProvider {
* @param {string} path is the folder to be copied over
* @param {Function} visitFile is a function called for each visited files
*/
_copyFolderToJsonInternal (path, visitFile) {
_copyFolderToJsonInternal (path, visitFile) {
visitFile = visitFile || (() => {})
return new Promise((resolve, reject) => {
const json = {}

@ -50,10 +50,10 @@ class WorkspaceFileProvider extends FileProvider {
async copyFolderToJson (directory, visitFile) {
visitFile = visitFile || (() => {})
const regex = new RegExp(`.workspaces/${this.workspace}/`, 'g');
const regex = new RegExp(`.workspaces/${this.workspace}/`, 'g')
let json = await super._copyFolderToJsonInternal(directory, ({ path, content }) => {
visitFile({ path: path.replace(regex, ''), content })
})
})
json = JSON.stringify(json).replace(regex, '')
return JSON.parse(json)
}

Loading…
Cancel
Save