diff --git a/ui/arduino2/main.css b/ui/arduino2/main.css index da59b1a..6d5754c 100644 --- a/ui/arduino2/main.css +++ b/ui/arduino2/main.css @@ -552,4 +552,5 @@ button.small .icon { border-radius: none; height: 100%; background: rgba(255, 255, 255, 0.5); + font-family: inherit; } diff --git a/ui/arduino2/store.js b/ui/arduino2/store.js index 2fe82dd..f4a9d9e 100644 --- a/ui/arduino2/store.js +++ b/ui/arduino2/store.js @@ -752,6 +752,31 @@ async function store(state, emitter) { log('upload-files') state.isTransferring = true emitter.emit('render') + + // Check which files will be overwritten on the board + const willOverwrite = await checkOverwrite({ + source: 'board', + fileNames: state.selectedFiles.map(f => f.fileName), + parentPath: serial.getFullPath( + state.boardNavigationRoot, + state.boardNavigationPath, + '' + ), + }) + + if (willOverwrite.length > 0) { + let message = `You are about to overwrite the following files/folders on your board:\n\n` + willOverwrite.forEach(f => message += `${f.fileName}\n`) + message += `\n` + message += `Are you sure you want to proceed?` + const confirmAction = confirm(message, 'Cancel', 'Yes') + if (!confirmAction) { + state.isTransferring = false + emitter.emit('render') + return + } + } + for (let i in state.selectedFiles) { const file = state.selectedFiles[i] const srcPath = disk.getFullPath( @@ -793,6 +818,30 @@ async function store(state, emitter) { state.isTransferring = true emitter.emit('render') + // Check which files will be overwritten on the disk + const willOverwrite = await checkOverwrite({ + source: 'disk', + fileNames: state.selectedFiles.map(f => f.fileName), + parentPath: disk.getFullPath( + state.diskNavigationRoot, + state.diskNavigationPath, + '' + ), + }) + + if (willOverwrite.length > 0) { + let message = `You are about to overwrite the following files/folders on your disk:\n\n` + willOverwrite.forEach(f => message += `${f.fileName}\n`) + message += `\n` + message += `Are you sure you want to proceed?` + const confirmAction = confirm(message, 'Cancel', 'Yes') + if (!confirmAction) { + state.isTransferring = false + emitter.emit('render') + return + } + } + for (let i in state.selectedFiles) { const file = state.selectedFiles[i] const srcPath = serial.getFullPath( @@ -971,7 +1020,7 @@ async function checkOverwrite({ fileNames = [], parentPath, source }) { let files = [] let overwrite = [] if (source === 'board') { - files = getBoardFiles(parentPath) + files = await getBoardFiles(parentPath) } else { files = await getDiskFiles(parentPath) }