Project path in idf.py

jhlee1
Posts: 8
Joined: Mon Sep 11, 2023 7:03 am

Project path in idf.py

Postby jhlee1 » Mon Feb 05, 2024 6:02 am

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.

User avatar
ESP_Roland
Posts: 257
Joined: Tue Oct 09, 2018 10:28 am

Re: Project path in idf.py

Postby ESP_Roland » Mon Feb 05, 2024 7:06 am

_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.

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 58 guests