Page 1 of 1

Project path in idf.py

Posted: Mon Feb 05, 2024 6:02 am
by jhlee1
Hi,
I'm using VSCode with extension Espressif IDF v1.6.4 and ESP-IDF v5.0.2 on Windows 10.

In my case, I set up a virtual drive the project path to prevent paths that may cause problems, such as spaces at project path.

For example, when creating and using a project called Blink,
Real path is D:\User\Test\ESP32\Projects\Blink, I set D:\User\Test\ESP32\Projects as P driver path and use abs path as P:\Blink.

However, after checking the message when building, it was confirmed that the path was referenced as a real path.
As a result of analyzing the cause, the following function was identified in the source code of idf.py.
Image

Q1. Why does idf.py use realpath rather than abspath?

Q2. Is it okay to use abspath instead of the _safe_relpath function?

Thanks.

Re: Project path in idf.py

Posted: Mon Feb 05, 2024 7:06 am
by ESP_Roland
_safe_relpath is used for printing the flashing command. This is not executed at all but is a convenience to the user for copy-pasting it. relpath generates a shorter relative path, e.g. build/hello_world.bin, instead of the full absolute path starting with the drive letter.

However, as you can see, in case the project is on a different drive, relpath throws ValueError and abspath is used instead.