Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ui/arduino2/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -552,4 +552,5 @@ button.small .icon {
border-radius: none;
height: 100%;
background: rgba(255, 255, 255, 0.5);
font-family: inherit;
}
51 changes: 50 additions & 1 deletion ui/arduino2/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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)
}
Expand Down