Skip to content

"Export Compiled Binary" saves binary under temporary folder when using an example sketch #1506

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

Closed
3 tasks done
Jens869 opened this issue Sep 29, 2022 · 5 comments
Closed
3 tasks done
Assignees
Labels
conclusion: declined Will not be worked on topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@Jens869
Copy link

Jens869 commented Sep 29, 2022

Describe the problem

When the user has never saved a new sketch, it is staged under the system temporary folder at a location something like:

C:\Users\per\AppData\Local\Temp\.arduinoIDE-unsaved2023517-20504-23cc4o.42k1f\Foo

In addition to the sketches created via File > New Sketch, example sketches are opened as a new sketch in order to prevent users from making inadvertent changes to the "known good" example code files.

🐛 If a "Export Compiled Binary" operation is done when a example sketch is open in the IDE, the binary is saved under that "staged" sketch folder under the system temporary folder.

To reproduce

  1. Use Library Manager to install the "ArduinoGraphics" library.
  2. Select File > Examples > ArduinoGraphics > ASCIIDraw from the Arduino IDE menus.
  3. Select Sketch > Export Compiled Binary from the Arduino IDE menus.
  4. Wait for the "Export Compiled Binary" operation to complete successfully.
  5. Select Sketch > Show Sketch Folder from the Arduino IDE menus.

🐛 The binary is saved somewhere like this:

C:\Users\per\AppData\Local\Temp\.arduinoIDE-unsaved2023517-20504-j7d70c.9dhkj\ASCIIDraw\build\arduino.avr.uno

Instead of the more convenient location:

C:\Users\per\Documents\Arduino\libraries\ArduinoGraphics\examples\ASCIIDraw\build\arduino.avr.uno

Expected behavior

Exported binary is saved in the source example sketch folder.

Arduino IDE version

2.0.0

Operating system

macOS

Operating system version

MacOS 11.6.8 Intel

Additional context

Arduino IDE 1.x has the expected behavior.

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details
@Jens869 Jens869 added the type: imperfection Perceived defect in any part of project label Sep 29, 2022
@per1234
Copy link
Contributor

per1234 commented Sep 29, 2022

The reason it is saved to that temporary folder is because the Arduino IDE 2.x opens example code in a temporary new sketch (as discussed at #925). The IDE does this because example sketches are intended to be treated as "read-only" so that the user does not unintentionally make modifications to what is expected to be "known good" reference code provided by the library author and Arduino.

So I'm not convinced that Arduino IDE 1.x saving the compiled binary inside what is intended to be somewhat of a "read-only" location was actually "right". On the other hand, doing so shouldn't cause problems like allowing a modification to the example code would because the presence of the exported binary in a sketch folder shouldn't affect the IDE in any way.

The workaround for the problem of the example sketch being in an odd temporary folder is to use File > Save As... to save the temporary new sketch to a persistent location on your hard drive.

the subfolder is hard to reach

Even in the temporary folder, it is sill just as easy to reach by selecting Sketch > Show Sketch Folder from the Arduino IDE menus.

@per1234 per1234 added the topic: code Related to content of the project itself label Sep 29, 2022
@kittaakos
Copy link
Contributor

kittaakos commented Sep 29, 2022

Arduino IDE 1.x saving the compiled binary inside what is intended to be somewhat of a "read-only" location was actually "right".

IDE2 can prompt a dialog and guide users to save the temp sketch before doing Sketch > Export Compiled Binary.

IDE 1.x shows this dialog when trying to save an example:

Screen Shot 2022-09-29 at 16 04 52

@Jens869

This comment was marked as off-topic.

@per1234

This comment was marked as off-topic.

@per1234 per1234 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 30, 2022
@per1234 per1234 added the conclusion: declined Will not be worked on label Sep 30, 2022
@per1234 per1234 self-assigned this Oct 5, 2022
@per1234 per1234 changed the title Sketch > Export compiled Binary "Export Compiled Binary" saves binary under temporary folder when sketch is new/staged Jun 18, 2023
@per1234 per1234 changed the title "Export Compiled Binary" saves binary under temporary folder when sketch is new/staged "Export Compiled Binary" saves binary under temporary folder when using an example sketch Jun 18, 2023
@hemangjoshi37a

This comment was marked as off-topic.

@arduino arduino locked as too heated and limited conversation to collaborators Jun 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
conclusion: declined Will not be worked on topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

4 participants