Description
Describe the problem
User sketches and global library installations are stored in the libraries
subfolder of the Arduino sketchbook folder. Several UI elements of the Arduino IDE reflect the contents of this folder and the build system also does library discovery from it.
The user may change the location of this sketchbook folder using the Sketchbook location preference of the Arduino IDE.
🐛 After the user changes the sketchbook location preference, the IDE's UI elements do not reflect the change to sketchbook sketches and available libraries.
To reproduce
- Select File > New from the Arduino IDE menus.
- Select Tools > Board > Arduino AVR Boards > Arduino Uno from the Arduino IDE menus.
ⓘ This is done to avoid variation in results that could be caused by platform bundled libraries of an arbitrary board selection. - Open the "Sketchbook" view.
- Take note of the sketches listed there.
- Select File > Sketchbook from the Arduino IDE menus.
- Take note of the sketches listed there.
- Select File > Examples from the Arduino IDE menus.
- Take note of the libraries listed there.
⚠️ There is a separate issue Complete list of examples are not always shown #262 which intermittently causes this menu to be incomplete. If you don't see the libraries you have installed listed in the menu (e.g., "Ethernet", "Firmata", "Keyboard"), then try selecting File > New to give the IDE another chance to populate the menu correctly. - Select Sketch > Include Library from the Arduino IDE menus.
- Take note of the libraries listed there.
- Select File > Preferences... from the Arduino IDE menus.
- Change the Sketchbook location preference to some other folder on your computer which already exists, and which contains different sketches and libraries (none at all is fine) from the current sketchbook folder.
ⓘ The bug occurs regardless of whether you set the new sketchbook path directly via the Sketchbook location field or using the dialog accessed by clicking the Browse button. - Click the OK button.
- Open the "Sketchbook" view.
🐛 The view shows the contents of the previous sketchbook location. - Select File > Sketchbook from the Arduino IDE menus.
🐛 The menu shows the sketches located in the previous sketchbook location.
🐛 The menu does not show the sketches located in the current sketchbook location. - Select File > Examples from the Arduino IDE menus.
🐛 The menu shows the examples of the libraries from the previous sketchbook location.
🐛 The menu does not show the examples of the libraries from the current sketchbook location. - Select Sketch > Include Library from the Arduino IDE menus.
🐛 The menu shows the libraries from the previous sketchbook location.
🐛 The menu does not show the libraries from the current sketchbook location. - Select one of the unexpected libraries from the menu.
#include
directive(s) for the library are added to the sketch. - Select Sketch > Verify/Compile from the Arduino IDE menus.
🐛 The compilation fails with a "No such file or directory
" error, since the library is not in one of the libraries paths. - Search for the library in Library Manager.
🐛 Library Manager shows the library as installed.
UPDATE: This specific part was resolved by #637, #906: Update package index on 3rd party URLs change. #1132. However, that resolution is unexpected since the index update (which triggers the reinitialization of Arduino CLI that updates the library installation status) should only be triggered on "Additional Boards Manager URLs" preference change. So the fact that the index update is currently (fc9107c at the time this is being written) being triggered on "Sketchbook location" preference change is a bug. - Install a library via Library Manager.
🐛 The library is installed to thelibraries
subfolder of the old sketchbook location.
UPDATE: This specific part has been resolved since the time of the report (though perhaps as a side effect of a bug, as described in the note regarding the Library Manager installation status). - Install a library via Sketch > Include Library > Add .ZIP Library...
🐛 The library is installed to thelibraries
subfolder of the old sketchbook location.
UPDATE: This specific part has been resolved since the time of the report (though perhaps as a side effect of a bug, as described in the note regarding the Library Manager installation status).
Expected behavior
All IDE data on sketchbook contents (sketches, libraries, manually installed boards platforms) is updated after changing the sketchbook location preference.
Arduino IDE version
Original report
2.0.0-rc3-snapshot.759b410
Last verified with
2.0.0-snapshot-42f6f43
Operating system
Windows
Operating system version
10
Additional context
In addition to the use case of the Sketchbook location preference for occasional long term change of the sketchbook location according to user whims, some advanced users dedicate a separate sketchbook to each project in order to provide it with a dedicated dependencies environment, which may include manually installed boards platforms in addition to libraries. These users frequently switch from one sketchbook to another and so are especially dependent on the IDE immediately recognizing that change.
The issue also applies to boards platforms manually installed to the hardware
subfolder of the sketchbook.
UPDATE: This specific part has been resolved since the time of the report (though perhaps as a side effect of a bug, as described in the note regarding the Library Manager installation status).
Possibly related to arduino/arduino-cli#1802
Issue checklist
- I searched for previous requests in the issue tracker
- I verified the feature was still missing when using the latest nightly build
- My request contains all necessary details