Skip to content

Fix path resolution #143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const Serial = {
return board.fs_save(content || ' ', filename, dataConsumer)
},
uploadFile: async (src, dest, dataConsumer) => {
return board.fs_put(src, dest, dataConsumer)
return board.fs_put(src, dest.replaceAll(path.win32.sep, path.posix.sep), dataConsumer)
},
downloadFile: async (src, dest) => {
let contents = await Serial.loadFile(src)
Expand Down
4 changes: 2 additions & 2 deletions ui/arduino/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -1509,7 +1509,7 @@ async function uploadFolder(srcPath, destPath, dataConsumer) {
let allFiles = await disk.ilistAllFiles(srcPath)
for (let i in allFiles) {
const file = allFiles[i]
const relativePath = file.path.substring(srcPath.length)
const relativePath = file.path.substring(srcPath.length+1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change does not seem to affect the process of uploading recursively. I have tested both and saw no changes in the final outcome.
also here you added 1 and at line 1526 removed the slicing.
not sure what this addresses

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is obsolete after your merged patch. This would remove a separator from the beginning of a relative path.

if (file.type === 'folder') {
await serial.createFolder(
serial.getFullPath(
Expand All @@ -1523,7 +1523,7 @@ async function uploadFolder(srcPath, destPath, dataConsumer) {
disk.getFullPath(srcPath, relativePath, ''),
serial.getFullPath(destPath, relativePath, ''),
(progress) => {
dataConsumer(progress, relativePath.slice(1))
dataConsumer(progress, relativePath)
}
)
}
Expand Down