Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix data loss when adding an existing file to sketch #5786

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
cmaglie merged 1 commit into arduino:master from polsys:FixAddFile
Mar 8, 2017

Conversation

Copy link
Contributor

@polsys polsys commented Jan 1, 2017

The addFile function checks for the case where source and destination are equal, for example when the user wants to update a sketch file modified outside the editor. However, the casing logic will delete the 'old' destination file before that, which causes the file to be lost.

Steps to reproduce (tested on Windows)

  1. Create a new sketch.
  2. Create a new file (code or data, doesn't matter) outside the editor. Add it to the sketch by dragging and dropping.
  3. Navigate to the sketch directory and drop the copied file again to the editor.
  4. A replacement confirmation dialog appears. Select OK.
  5. (If the file was a data file, a message box about this being a no-op appears.)
  6. The file is deleted on the disk. An exception is logged if the file was a code file.

The changes in this PR:

  • Coalesced the file equality checks so that no file operations are performed if source and destination are same.
  • Removed the data file no-op message. I didn't touch the localization files, being unfamiliar with them, I guess it should be removed there as well?

While the previous version could handle the case, it only did so after
deleting the destination file, therefore causing data loss.
@facchinm facchinm added Component: IDE The Arduino IDE feature request A request to make an enhancement (not a bug fix) labels Jan 2, 2017
@facchinm facchinm added this to the Release 1.8.2 milestone Feb 28, 2017
@cmaglie cmaglie self-assigned this Feb 28, 2017
@cmaglie cmaglie merged commit 1fc0997 into arduino:master Mar 8, 2017
Copy link
Member

cmaglie commented Mar 8, 2017

Thank you!

There is no problem with localization strings, they are updated automatically with gettext (we run this tool periodically to cleanup/update translations).

polsys reacted with thumbs up emoji

@polsys polsys deleted the FixAddFile branch March 8, 2017 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Labels
Component: IDE The Arduino IDE feature request A request to make an enhancement (not a bug fix)
Projects
None yet
Milestone
Release 1.8.2
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /