Skip to content

Option to add existing files to a sketch #284

Closed
@Lorandil

Description

@Lorandil

Describe the request

It would be great if the files drop down menu would allow to "add existing files"

Describe the current behavior

If I want to reuse some code I wrote earlier without creating a library, I manually copy those files to the sketch folder.

At the moment I have to restart the IDE to integrate them into the sketch. (tracked at #296)

Expected behavior

It is possible to add existing code files to a sketch via the Arduino IDE GUI.

Arduino IDE version

76f9f63

Operating system

Windows

Operating system version

10

Additional context

Additional reports:

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

Activity

ubidefeo

ubidefeo commented on Mar 28, 2021

@ubidefeo

@per1234
This one is something I have also found myself in need of.
What's your opinion?

per1234

per1234 commented on Mar 29, 2021

@per1234
Contributor

I don't think it would do any harm. This tabs menu is not something a beginner needs to use, so adding additional functionality to it doesn't add complexity to the beginner's UI.

ubidefeo

ubidefeo commented on Mar 30, 2021

@ubidefeo

thanks @per1234

let's create a task for this :)

per1234

per1234 commented on Dec 24, 2022

@per1234
Contributor

Thanks to a forum user, I just discovered that Arduino IDE 1.x has this capability, so this is actually a matter of feature parity.

I remember that when the Sketch > Add File... capability was added to Arduino IDE 2.x, it was specified as a way to add supplemental files (e.g., documentation) to the data subfolder of the sketch. I never used this feature in Arduino IDE 1.x, but now that I try it out, I see the Arduino IDE 1.x behavior is more complex than what was specified for the Arduino IDE 2.x implementation:

  • If the selected file has a supported sketch code file extension (e.g., .ino, .h, .cpp, .c, .S), add it to the the root of the sketch folder.
  • If the selected file has any other file extension, add it to the data subfolder of the sketch.

Arduino IDE 2.x's Sketch > Add File... capability always does the second of these, even when adding a file with a supported sketch code file extension.

self-assigned this
on Dec 25, 2022
kittaakos

kittaakos commented on Jan 6, 2023

@kittaakos
Contributor
  • If the selected file has a supported sketch code file extension (e.g., .ino, .h, .cpp, .c, .S), add it to the the root of the sketch folder.

And '.hpp', and '.hh'.

added a commit that references this issue on Jan 6, 2023
b0115ea
added a commit that references this issue on Jan 11, 2023
197cea2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @kittaakos@ubidefeo@per1234@Lorandil

    Issue actions

      Option to add existing files to a sketch · Issue #284 · arduino/arduino-ide