Skip to content

"Save As" fails when attempting to replace existing sketch #217

Open
@per1234

Description

@per1234

Describe the problem

When an existing sketch file is selected during a "Save as.." operation, the IDE asks the user to confirm the overwrite, but does not overwrite regardless of the user's choice.

To reproduce

  1. Select File > New from the Arduino IDE menus.

  2. Select File > Save as... from the Arduino IDE menus.

  3. Save the sketch to a convenient location.
    I'll refer to this sketch as "Sketch1", but the name doesn't matter.

  4. Select File > New from the Arduino IDE menus.

  5. Modify the text in the sketch file so it's different from the "Sketch1" sketch.

  6. Select File > Save as... from the Arduino IDE menus.

  7. Open the folder containing "Sketch1".

  8. Click on Sketch1.ino

  9. Click the "Save" button.
    A dialog opens:

    Confirm Save As

    Sketch1.ino already exists.
    Do you want to replace it?

    Clipboard01

  10. Click the Yes button, indicating you want to replace Sketch1.ino.

  11. Open Sketch1.ino in a text editor.

🐛 Sketch1.ino contains the original text it was first saved with.

Expected behavior

When I confirm I want to overwrite the sketch, it should be overwritten.

Arduino IDE version

Original report

2.0.0-beta.3-snapshot.520b3a8

Last verified with

9a6a457

Operating system

Windows

Operating system version

11

Additional context

This also occurs when doing a "Save As..." with "Sketch1". But that requires having "Auto Save" disabled and risks being mistaken for #65.

For this reason, I chose to use two sketches in the demo, which works regardless of the "Auto Save" setting.


This works as expected when using Arduino IDE 1.x.


I also tested this with the build from #211 with the same results I described above.

Additional reports

Metadata

Metadata

Assignees

Labels

criticality: mediumOf moderate impacttopic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions