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){
219
222
// Define parent folder
220
223
if(openFile.source=='board'){
221
224
openFile.parentFolder=state.boardNavigationPath
222
-
// Check for overwrite
223
-
willOverwrite=awaitserial.fileExists(
224
-
serial.getFullPath(
225
-
state.boardNavigationRoot,
226
-
openFile.parentFolder,
227
-
openFile.fileName
228
-
)
229
-
)
230
225
}elseif(openFile.source=='disk'){
231
226
openFile.parentFolder=state.diskNavigationPath
232
-
// Check for overwrite
233
-
willOverwrite=awaitdisk.fileExists(
234
-
disk.getFullPath(
235
-
state.diskNavigationRoot,
236
-
openFile.parentFolder,
237
-
openFile.fileName
238
-
)
239
-
)
240
227
}
241
228
242
-
}elseif(openFile.parentFolder!==null){
243
-
// Check if the current full path exists
244
-
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
245
253
if(openFile.source=='board'){
246
-
fullPathExists=awaitserial.fileExists(
254
+
openFile.parentFolder=state.boardNavigationPath
255
+
// Check for overwrite
256
+
willOverwrite=awaitserial.fileExists(
247
257
serial.getFullPath(
248
258
state.boardNavigationRoot,
249
259
openFile.parentFolder,
250
260
openFile.fileName
251
261
)
252
262
)
253
263
}elseif(openFile.source=='disk'){
254
-
fullPathExists=awaitdisk.fileExists(
264
+
openFile.parentFolder=state.diskNavigationPath
265
+
// Check for overwrite
266
+
willOverwrite=awaitdisk.fileExists(
255
267
disk.getFullPath(
256
268
state.diskNavigationRoot,
257
269
openFile.parentFolder,
258
270
openFile.fileName
259
271
)
260
272
)
261
273
}
262
-
263
-
if(!fullPathExists){
264
-
// Redefine parent folder
265
-
if(openFile.source=='board'){
266
-
openFile.parentFolder=state.boardNavigationPath
267
-
// Check for overwrite
268
-
willOverwrite=awaitserial.fileExists(
269
-
serial.getFullPath(
270
-
state.boardNavigationRoot,
271
-
openFile.parentFolder,
272
-
openFile.fileName
273
-
)
274
-
)
275
-
}elseif(openFile.source=='disk'){
276
-
openFile.parentFolder=state.diskNavigationPath
277
-
// Check for overwrite
278
-
willOverwrite=awaitdisk.fileExists(
279
-
disk.getFullPath(
280
-
state.diskNavigationRoot,
281
-
openFile.parentFolder,
282
-
openFile.fileName
283
-
)
284
-
)
285
-
}
286
-
}
287
274
}
288
275
289
276
if(willOverwrite){
290
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')
291
278
if(!confirmation){
292
279
state.isSaving=false
293
-
openFile.parentFolder=null
280
+
openFile.parentFolder=oldParentFolder
294
281
emitter.emit('render')
295
282
return
296
283
}
@@ -368,7 +355,7 @@ async function store(state, emitter) {
368
355
if(state.isConnected){
369
356
state.boardFiles=awaitgetBoardFiles(
370
357
serial.getFullPath(
371
-
'/',
358
+
state.boardNavigationRoot,
372
359
state.boardNavigationPath,
373
360
''
374
361
)
@@ -784,6 +771,17 @@ async function store(state, emitter) {
0 commit comments