Skip to content

build.path with relative path specified creates new sub sub sub "$(build.path)/sketch/" directories on every run #5077

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

Open
plocher opened this issue Jun 27, 2016 · 6 comments
Assignees

Comments

@plocher
Copy link

plocher commented Jun 27, 2016

MacOS IDE environment
$(ARDUINO) --pref build.path=./obj --board $(BUILD) --verify CP_Sargent.ino

After 4x invocations, the ./obj directory contains 4x nested instances of "obj/sketch". Each invocation adds yet another subdirectory structure...

./obj/sketch
./obj/sketch/CP_Sargent.ino.cpp
./obj/sketch/CP_Sargent.ino.cpp.d
./obj/sketch/CP_Sargent.ino.cpp.o
./obj/sketch/obj
./obj/sketch/obj/preproc
./obj/sketch/obj/preproc/ctags_target.cpp
./obj/sketch/obj/sketch
./obj/sketch/obj/sketch/CP_Sargent.ino.cpp
./obj/sketch/obj/sketch/obj
./obj/sketch/obj/sketch/obj/preproc
./obj/sketch/obj/sketch/obj/preproc/ctags_target.cpp
./obj/sketch/obj/sketch/obj/sketch
./obj/sketch/obj/sketch/obj/sketch/CP_Sargent.ino.cpp
./obj/sketch/obj/sketch/obj/sketch/obj
./obj/sketch/obj/sketch/obj/sketch/obj/preproc
./obj/sketch/obj/sketch/obj/sketch/obj/preproc/ctags_target.cpp
./obj/sketch/obj/sketch/obj/sketch/obj/sketch
./obj/sketch/obj/sketch/obj/sketch/obj/sketch/CP_Sargent.ino.cpp

Changing the CLI to use an absolute path is a workarround for this issue:
$(ARDUINO) --pref build.path=$(PWD)/obj --board $(BUILD) --verify CP_Sargent.ino

@plocher plocher changed the title build.path with relative path specified creates new sub sub sub directories on every run build.path with relative path specified creates new sub sub sub "$(build.path)/sketch/" directories on every run Jun 27, 2016
@facchinm facchinm added Type: Bug OS: OSX Specific to the Mac OS X (macOS) version of the Arduino IDE labels Jun 27, 2016
@matthijskooijman
Copy link
Collaborator

I believe the problem is not so much a relative path, but having a build path inside the source directory.

Also, this is a duplicate of arduino/arduino-builder#89 which is already fixed in git master (and should be fixed in the next IDE release).

@matthijskooijman matthijskooijman added the Type: Duplicate Another item already exists for this topic label Jun 27, 2016
@matthijskooijman
Copy link
Collaborator

Hm, wait, if you change it to an absolute path, it does work. Seems I read to quickly, this might be another issue after all.

I'm curious as to this is fixed with fixing the issue linked above.

@cmaglie, I think the commit to fix that arduino-builder issue is not yet present in an arduino-builder release, and thus also not in the Arduino IDE nightly build. Perhaps you could make an arduino-builder release so @plocher can check if this issue is fixed?

@matthijskooijman matthijskooijman removed the Type: Duplicate Another item already exists for this topic label Jun 27, 2016
@legionaryu
Copy link

legionaryu commented Oct 25, 2017

I can confirm that the same thing is happening on Windows 10 when using the "arduino_debug.exe" from the command line on Windows.

It happens even with full path, from my own debugging, the issue is related to the folder content, e.g., if the build.path folder is empty, then it uses the folder as output for the binaries and etc, else it creates a new folder inside the folder "sketch" with the same name as the build.path folder, repeating these conditionals recursively.

My Arduino version is 1.8.3

Cheers

@per1234
Copy link
Collaborator

per1234 commented Oct 25, 2017

@legionaryu it's not really helpful for you to do testing with outdated versions of the Arduino IDE. Currently, all testing should be done using the beta build: https://www.arduino.cc/en/Main/Software#beta.

@legionaryu
Copy link

@per1234 I've just tested using the version 'arduino-PR-beta1.9-BUILD-22' and the problem still happens.
I'm executing the following command: arduino_debug.exe --verify --board arduino:avr:uno c:\ArduinoTester\ArduinoTester.ino --verbose --pref build.path="c:\ArduinoTester\build"

You can see, in the image below, that 'arduino_debug.exe' keeps creating new 'build' folders recursively:
hierarchy

@legionaryu
Copy link

legionaryu commented Oct 26, 2017

I was trying to find the issue in the source and I found the method saveHex, my 'spider sense' tells me that the issue has something to do with the following conditional:

      if (Files.exists(compiledSketchPathInSubfolder)) {
        compiledSketchPath = compiledSketchPathInSubfolder;
      } else if (Files.exists(compiledSketchPathInBuildPath)) {
        compiledSketchPath = compiledSketchPathInBuildPath;
      } else {
        return;
      }

The line that creates new folders probably is this one -> Files.copy(compiledSketchPath, copyOfCompiledSketchFilePath, StandardCopyOption.REPLACE_EXISTING);

@facchinm facchinm removed the OS: OSX Specific to the Mac OS X (macOS) version of the Arduino IDE label Oct 27, 2017
@facchinm facchinm self-assigned this Oct 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants