Description
When the Arduino IDE is invoked via the command line for a Verify or Upload task, such as when an external tool like microsoft/vscode-arduino invokes a build, but the name of the sketch file provided on the command line does not match its containing folder name, the first file from FileUtils.listFiles
is used as the "primary" file, resulting in undefined behavior (the order returned by listFiles
seems non-deterministic) and apparent obscure bugs such as the one I filed at microsoft/vscode-arduino#1100.
The requirement to have the .ino
file match the folder name seems arbitrary and restrictive for command-line compilations when the IDE itself is not being used for development. I developed a simple fix for this on my own branch and plan on filing a PR.