You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if(openFile.parentFolder===null){// it's a new file
218
+
constoldParentFolder=openFile.parentFolder
219
+
constisNewFile=oldParentFolder===null
220
+
221
+
if(isNewFile){
218
222
// Define parent folder
219
223
if(openFile.source=='board'){
220
224
openFile.parentFolder=state.boardNavigationPath
221
-
// Check for overwrite
222
-
willOverwrite=awaitserial.fileExists(
223
-
serial.getFullPath(
224
-
state.boardNavigationRoot,
225
-
openFile.parentFolder,
226
-
openFile.fileName
227
-
)
228
-
)
229
225
}elseif(openFile.source=='disk'){
230
226
openFile.parentFolder=state.diskNavigationPath
231
-
// Check for overwrite
232
-
willOverwrite=awaitdisk.fileExists(
233
-
disk.getFullPath(
234
-
state.diskNavigationRoot,
235
-
openFile.parentFolder,
236
-
openFile.fileName
237
-
)
238
-
)
239
227
}
240
228
241
-
}elseif(openFile.parentFolder!==null){
242
-
// Check if the current full path exists
243
-
letfullPathExists=false
229
+
}
230
+
231
+
// Check if the current full path exists
232
+
letfullPathExists=false
233
+
if(openFile.source=='board'){
234
+
fullPathExists=awaitserial.fileExists(
235
+
serial.getFullPath(
236
+
state.boardNavigationRoot,
237
+
openFile.parentFolder,
238
+
openFile.fileName
239
+
)
240
+
)
241
+
}elseif(openFile.source=='disk'){
242
+
fullPathExists=awaitdisk.fileExists(
243
+
disk.getFullPath(
244
+
state.diskNavigationRoot,
245
+
openFile.parentFolder,
246
+
openFile.fileName
247
+
)
248
+
)
249
+
}
250
+
251
+
if(isNewFile||!fullPathExists){
252
+
// Redefine parent folder
244
253
if(openFile.source=='board'){
245
-
fullPathExists=awaitserial.fileExists(
254
+
openFile.parentFolder=state.boardNavigationPath
255
+
// Check for overwrite
256
+
willOverwrite=awaitserial.fileExists(
246
257
serial.getFullPath(
247
258
state.boardNavigationRoot,
248
259
openFile.parentFolder,
249
260
openFile.fileName
250
261
)
251
262
)
252
263
}elseif(openFile.source=='disk'){
253
-
fullPathExists=awaitdisk.fileExists(
264
+
openFile.parentFolder=state.diskNavigationPath
265
+
// Check for overwrite
266
+
willOverwrite=awaitdisk.fileExists(
254
267
disk.getFullPath(
255
268
state.diskNavigationRoot,
256
269
openFile.parentFolder,
257
270
openFile.fileName
258
271
)
259
272
)
260
273
}
261
-
262
-
if(!fullPathExists){
263
-
// Redefine parent folder
264
-
if(openFile.source=='board'){
265
-
openFile.parentFolder=state.boardNavigationPath
266
-
// Check for overwrite
267
-
willOverwrite=awaitserial.fileExists(
268
-
serial.getFullPath(
269
-
state.boardNavigationRoot,
270
-
openFile.parentFolder,
271
-
openFile.fileName
272
-
)
273
-
)
274
-
}elseif(openFile.source=='disk'){
275
-
openFile.parentFolder=state.diskNavigationPath
276
-
// Check for overwrite
277
-
willOverwrite=awaitdisk.fileExists(
278
-
disk.getFullPath(
279
-
state.diskNavigationRoot,
280
-
openFile.parentFolder,
281
-
openFile.fileName
282
-
)
283
-
)
284
-
}
285
-
}
286
274
}
287
275
288
276
if(willOverwrite){
289
277
constconfirmation=confirm(`You are about to overwrite the file ${openFile.fileName} on your ${openFile.source}.\n\n Are you sure you want to proceed?`,'Cancel','Yes')
290
278
if(!confirmation){
291
279
state.isSaving=false
292
-
openFile.parentFolder=null
280
+
openFile.parentFolder=oldParentFolder
293
281
emitter.emit('render')
294
282
return
295
283
}
@@ -367,7 +355,7 @@ async function store(state, emitter) {
367
355
if(state.isConnected){
368
356
state.boardFiles=awaitgetBoardFiles(
369
357
serial.getFullPath(
370
-
'/',
358
+
state.boardNavigationRoot,
371
359
state.boardNavigationPath,
372
360
''
373
361
)
@@ -641,8 +629,8 @@ async function store(state, emitter) {
641
629
state.renamingFile=source
642
630
emitter.emit('render')
643
631
})
644
-
emitter.on('finish-renaming',async(value)=>{
645
-
log('finish-renaming',value)
632
+
emitter.on('finish-renaming-file',async(value)=>{
633
+
log('finish-renaming-file',value)
646
634
647
635
// You can only rename one file, the selected one
648
636
constfile=state.selectedFiles[0]
@@ -776,6 +764,207 @@ async function store(state, emitter) {
constconfirmation=confirm(`You are about to overwrite the file ${openFile.fileName} on your ${openFile.source}.\n\n Are you sure you want to proceed?`,'Cancel','Yes')
0 commit comments