Okay this has a second part. There is code that attempts to do that
However the path that it constructs here in my case is C:\Users\Maxi\.platformio\packages\framework-stm32cube\f4\Drivers\BSP\DISCO_F429ZI
and not C:\Users\Maxi\.platformio\packages\framework-stm32cube\f4\Drivers\BSP\STM32F429I-Discovery
. In general variant
may not correspond to the folder names inside that directory.