@@ -143,6 +143,7 @@ function store(state, emitter) {
143
143
let editor = state . cache ( AceEditor , 'editor' ) . editor
144
144
let contents = editor . getValue ( )
145
145
let filename = state . selectedFile || 'undefined'
146
+ let deviceName = state . selectedDevice === 'serial' ? 'board' : 'disk'
146
147
147
148
if ( state . selectedDevice === 'serial' ) {
148
149
await serial . saveFileContent ( filename , contents )
@@ -153,7 +154,7 @@ function store(state, emitter) {
153
154
}
154
155
155
156
emitter . emit ( 'update-files' )
156
- emitter . emit ( 'message' , `${ filename } is saved on ${ state . selectedDevice } .` , 1000 )
157
+ emitter . emit ( 'message' , `${ filename } is saved on ${ deviceName } .` , 1000 )
157
158
} )
158
159
emitter . on ( 'remove' , async ( ) => {
159
160
log ( 'remove' )
@@ -318,6 +319,7 @@ function store(state, emitter) {
318
319
log ( 'save-filename' , filename )
319
320
let oldFilename = state . selectedFile
320
321
state . selectedFile = filename
322
+ let deviceName = state . selectedDevice === 'serial' ? 'board' : 'disk'
321
323
322
324
let editor = state . cache ( AceEditor , 'editor' ) . editor
323
325
let contents = editor . getValue ( )
@@ -326,7 +328,6 @@ function store(state, emitter) {
326
328
// Ask for confirmation to overwrite existing file
327
329
let confirmation = true
328
330
if ( state . serialFiles . indexOf ( filename ) !== - 1 ) {
329
- let deviceName = state . selectedDevice === 'serial' ? 'board' : 'disk'
330
331
confirmation = confirm ( `Do you want to overwrite ${ filename } on ${ deviceName } ?` )
331
332
}
332
333
@@ -343,7 +344,7 @@ function store(state, emitter) {
343
344
emitter . emit ( 'update-files' )
344
345
emitter . emit ( 'render' )
345
346
346
- emitter . emit ( 'message' , `${ filename } is saved on ${ state . selectedDevice } .` , 1000 )
347
+ emitter . emit ( 'message' , `${ filename } is saved on ${ deviceName } .` , 1000 )
347
348
} else {
348
349
state . isEditingFilename = false
349
350
emitter . emit ( 'render' )
@@ -354,7 +355,6 @@ function store(state, emitter) {
354
355
// Ask for confirmation to overwrite existing file
355
356
let confirmation = true
356
357
if ( state . diskFiles . indexOf ( filename ) !== - 1 ) {
357
- let deviceName = state . selectedDevice === 'serial' ? 'board' : 'disk'
358
358
confirmation = confirm ( `Do you want to overwrite ${ filename } on ${ deviceName } ?` )
359
359
}
360
360
if ( confirmation ) {
@@ -370,7 +370,7 @@ function store(state, emitter) {
370
370
emitter . emit ( 'update-files' )
371
371
emitter . emit ( 'render' )
372
372
373
- emitter . emit ( 'message' , `${ filename } is saved on ${ state . selectedDevice } .` , 1000 )
373
+ emitter . emit ( 'message' , `${ filename } is saved on ${ deviceName } .` , 1000 )
374
374
} else {
375
375
state . isEditingFilename = false
376
376
emitter . emit ( 'render' )
0 commit comments