save on the current file provider and not only on browser/

pull/1/head
yann300 7 years ago
parent 6e6bfcc373
commit b47f14622a
  1. 17
      src/app/tabs/run-tab.js

@ -279,12 +279,17 @@ function makeRecorder (appAPI, appEvents) {
` `
recordButton.onclick = () => { recordButton.onclick = () => {
var txJSON = JSON.stringify(recorder.getAll(), null, 2) var txJSON = JSON.stringify(recorder.getAll(), null, 2)
modalDialogCustom.prompt(null, 'save ran transactions to file (e.g. `scenario.json`)', 'scenario.json', input => { var path = appAPI.currentPath()
var newName = appAPI.filesProviders['browser'].type + '/' + helper.createNonClashingName(input, appAPI.filesProviders['browser'], '.json') modalDialogCustom.prompt(null, 'save ran transactions to file (e.g. `scenario.json`). The file is goiing to be saved under ' + path, 'scenario.json', input => {
if (!appAPI.filesProviders['browser'].set(newName, txJSON)) { var fileProvider = appAPI.fileProviderOf(path)
modalDialogCustom.alert('Failed to create file ' + newName) if (fileProvider) {
} else { input = helper.createNonClashingName(input, fileProvider, '.json')
appAPI.switchFile(newName) var newFile = path + input
if (!fileProvider.set(newFile, txJSON)) {
modalDialogCustom.alert('Failed to create file ' + newFile)
} else {
appAPI.switchFile(newFile)
}
} }
}) })
} }

Loading…
Cancel
Save