fix recorder

pull/1647/head
filip mertens 3 years ago
parent 870ca2bb1f
commit fbe86095ea
  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 txJSON = JSON.stringify(this.recorder.getAll(), null, 2)
var path = this.fileManager.currentPath() var path = this.fileManager.currentPath()
promptCb(path, input => { promptCb(path, async input => {
var fileProvider = this.fileManager.fileProviderOf(path) var fileProvider = this.fileManager.fileProviderOf(path)
if (!fileProvider) return if (!fileProvider) return
var newFile = path + '/' + input var newFile = path + '/' + input
helper.createNonClashingName(newFile, fileProvider, async (error, newFile) => { try {
if (error) return cb('Failed to create file. ' + newFile + ' ' + error) newFile = await helper.createNonClashingNameAsync(newFile, this.fileManager)
if (!await fileProvider.set(newFile, txJSON)) return cb('Failed to create file ' + newFile) await fileProvider.set(newFile, txJSON)
await this.fileManager.open(newFile) await this.fileManager.open(newFile)
}) } catch (error) {
if (error) return cb('Failed to create file. ' + newFile + ' ' + error)
}
}) })
} }
} }

Loading…
Cancel
Save