motform / arduino-cli-mode

emacs support for the arduino-cli

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compile and upload absolute path

npalladino100 opened this issue · comments

When I compile and upload, it seems to run the command "arduino-cli compile --fqbn arduino:avr:uno [absolute path]," with the absolute path to the file. I believe the proper command would be like this: "arduino-cli compile --fqbn arduino:avr:uno" without the path at the end.
image

Hi! That looks strange. arduino-cli-compile does need a path to the sketch folder, otherwise it won't know what to compile. The usage example in error message is a bit confusing in this regard, as the argument it expects is the path, not the -b/--fqbn flag. The help screen gives us a more useful example: /usr/local/bin/arduino-cli compile -b arduino:avr:uno /home/user/Arduino/MySketch.

I managed to compile an empty file with your command line invocation on MacOS both through arduino-cli-mode and the shell. It seems like you are running Windows, so the issue might have to do with the path using the wrong type of path separator (/ as opposed to \)? The path is read through default-directory, which I assumed was cross platform safe.

The command works when I leave off the path at the end, or if I just type the filename. I tried putting quotes around the path, and that also works. I believe the reason it's not working is the space in the path, so the path should be surrounded by quotes.

Ah, of course! I had forgotten to shell-quote-argument the default-directory. I have pushed a commit (10d5cfa) that should fix this. Could you try again?

It works perfectly now.

Perfect! I'll close this issue, but feel free to open it if you encounter any more oddities.