Skip to content

Opening invalid sketch via file association/command line fails silently #964

Closed
@Chose99

Description

@Chose99

Describe the problem

An Arduino sketch is a folder. This folder must contain an .ino file matching the folder name:

Foo/
└── Foo.ino

Users who have only worked with the single file sketches common in introductory tutorials and examples may have the impression that the file is the sketch. Sketch authors may distribute sketches as a file or inline code for convenience. Some distribution methods (e.g., GitHub's automatically generated ZIP files) may alter the name of the sketch folder. Any of these things may result in an invalid sketch due to the lack of alignment between folder and .ino file name.

For example:

Foo/
└── Bar.ino

If I start the Arduino IDE by opening a sketch that does not contain a .ino file matching the folder name (which is required for it to be considered valid), the IDE opens with the same behavior as it would without a sketch argument (last loaded sketches are opened).

To reproduce

  1. Create a sketch that does not meet the naming requirements.
    For example:
    Foo/
    └── Bar.ino
    
  2. Open the sketch directly, either from Windows "File Explorer" if you have .ino file association configured, or by running the IDE from the command line with the sketch path as an argument.
    & ".\Arduino IDE" "C:\Users\per\Documents\Arduino\Foo\Bar.ino"
    

🐛 The IDE does not communicate the problem to the user. The user is more likely to think something is wrong with the IDE than with the sketch.
🐛 The IDE does not offer to move the sketch file to an appropriately named folder

Expected behavior

The same behavior as when opening the file via File > Open in the Arduino IDE, as it works in Arduino IDE 1.x.

image

Arduino IDE version

Original report

2.0.0-rc6-nightly-20220422

Last verified with

2.0.1-snapshot-8380c82

Operating system

Windows

Operating system version

10.0.19044

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions