Skip to content
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

Compile command doesn't resolve Sketch path correctly on Windows #1285

Closed
silvanocerza opened this issue May 10, 2021 · 1 comment
Closed
Assignees
Labels
os: windows Specific to Windows operating system topic: CLI Related to the command line interface topic: gRPC Related to the gRPC interface type: imperfection Perceived defect in any part of project

Comments

@silvanocerza
Copy link
Contributor

Bug Report

Current behavior

$ arduino-cli.exe compile -b arduino:avr:uno "C:\Users\The Alien\Documents\Arduino\Blink\"
Error during build: opening sketch: no valid sketch found in C:\Users\The Alien\Documents\Arduino: missing C:\Users\The Alien\Documents\Arduino\Arduino.ino

Calling the compile command on Windows using the Sketch folder searches for the Sketch main file in the parent folder.

Calling it with the Sketch main .ino file works as expected.

# Works correctly
$ arduino-cli.exe compile -b arduino:avr:uno "C:\Users\The Alien\Documents\Arduino\Blink\Blink.ino"
Sketch uses 924 bytes (2%) of program storage space. Maximum is 32256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.

It also works when it shouldn't, all the following commands must fail:

$ arduino-cli.exe compile -b arduino:avr:uno "C:\Users\The Alien\Documents\Arduino\Blink\a\"
$ arduino-cli.exe compile -b arduino:avr:uno "C:\Users\The Alien\Documents\Arduino\Blink\Blink\"
$ arduino-cli.exe compile -b arduino:avr:uno "C:\Users\The Alien\Documents\Arduino\Blink\anything\"

Expected behavior

The following commands must work:

$ arduino-cli.exe compile -b arduino:avr:uno "C:\Users\The Alien\Documents\Arduino\Blink\"
$ arduino-cli.exe compile -b arduino:avr:uno "C:\Users\The Alien\Documents\Arduino\Blink\Blink.ino"

These instead must fail:

$ arduino-cli.exe compile -b arduino:avr:uno "C:\Users\The Alien\Documents\Arduino\Blink\a\"
$ arduino-cli.exe compile -b arduino:avr:uno "C:\Users\The Alien\Documents\Arduino\Blink\Blink\"
$ arduino-cli.exe compile -b arduino:avr:uno "C:\Users\The Alien\Documents\Arduino\Blink\anything\"

Environment

  • CLI version (output of arduino-cli version): 0.18.1
  • OS and platform: Windows x64

Additional context

@silvanocerza silvanocerza added type: bug os: windows Specific to Windows operating system labels May 10, 2021
@silvanocerza silvanocerza self-assigned this May 10, 2021
@rsora rsora removed the topic: CLI label Sep 16, 2021
@fstasi fstasi removed the type: bug label Sep 16, 2021
@rsora rsora added type: imperfection Perceived defect in any part of project topic: gRPC Related to the gRPC interface topic: CLI Related to the command line interface labels Sep 22, 2021
@MatteoPologruto
Copy link
Contributor

Using cli version 0.29.0, compile behaves as expected in all of the above mentioned cases:

  • compile with sketch folder as path:
C:\Users\m.pologruto>arduino-cli version
arduino-cli  Version: 0.29.0 Commit: 76251df9 Date: 2022-11-17T09:21:37Z

C:\Users\m.pologruto>arduino-cli compile -b arduino:avr:uno C:\Users\m.pologruto\Documents\Arduino\blink\
Sketch uses 444 bytes (1%) of program storage space. Maximum is 32256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.


Used platform Version Path
arduino:avr   1.8.3   C:\Users\m.pologruto\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.3
  • compile with sketch main .ino:
C:\Users\m.pologruto>arduino-cli compile -b arduino:avr:uno C:\Users\m.pologruto\Documents\Arduino\blink\blink.ino
Sketch uses 444 bytes (1%) of program storage space. Maximum is 32256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.


Used platform Version Path
arduino:avr   1.8.3   C:\Users\m.pologruto\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.3
  • compile with random directories inside of sketch folder:
C:\Users\m.pologruto>arduino-cli compile -b arduino:avr:uno C:\Users\m.pologruto\Documents\Arduino\blink\a\
Error opening sketch: no such file or directory: C:\Users\m.pologruto\Documents\Arduino\blink\a

C:\Users\m.pologruto>arduino-cli compile -b arduino:avr:uno C:\Users\m.pologruto\Documents\Arduino\blink\blink\
Error opening sketch: no such file or directory: C:\Users\m.pologruto\Documents\Arduino\blink\blink

C:\Users\m.pologruto>arduino-cli compile -b arduino:avr:uno C:\Users\m.pologruto\Documents\Arduino\blink\anything\
Error opening sketch: no such file or directory: C:\Users\m.pologruto\Documents\Arduino\blink\anything

I'm closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
os: windows Specific to Windows operating system topic: CLI Related to the command line interface topic: gRPC Related to the gRPC interface type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

5 participants