fix recorder

pull/5370/head
filip mertens 3 years ago
parent ac8b4ac003
commit f8845d7fd5
  1. 14
      apps/remix-ide/src/app/tabs/runTab/recorder.js

@ -141,18 +141,20 @@ class RecorderUI extends Plugin {
)
}
saveScenario (promptCb, cb) {
async saveScenario (promptCb, cb) {
var txJSON = JSON.stringify(this.recorder.getAll(), null, 2)
var path = this.fileManager.currentPath()
promptCb(path, input => {
promptCb(path, async input => {
var fileProvider = this.fileManager.fileProviderOf(path)
if (!fileProvider) return
var newFile = path + '/' + input
helper.createNonClashingName(newFile, fileProvider, async (error, newFile) => {
if (error) return cb('Failed to create file. ' + newFile + ' ' + error)
if (!await fileProvider.set(newFile, txJSON)) return cb('Failed to create file ' + newFile)
try {
newFile = await helper.createNonClashingNameAsync(newFile, this.fileManager)
await fileProvider.set(newFile, txJSON)
await this.fileManager.open(newFile)
})
} catch (error) {
if (error) return cb('Failed to create file. ' + newFile + ' ' + error)
}
})
}
}

Loading…
Cancel
Save