host: utils: Fixed python script paths under utils for windows

When uhd_usrp_probe is executed with incompatible UHD and FPGA images,
we get the expected incompat error. The problem is that on windows,
this error messages prints an incorrect file path to uhd_images_downloader.py.
It mentions folder "bin" but the python script is located under "lib".

For example:
current behavior "C:\Program Files\UHD\bin\uhd\utils\uhd_images_downloader.py"
expected behavior "C:\Program Files\UHD\lib\uhd\utils\uhd_images_downloader.py"

This fix is addressed by updating find_utility() function. Since, the dll in
windows is present under /bin, the get_lib_path() returns this path and
not the /lib path. To get the correct path, get_lib_path() is replaced by
get_pkg_path() and the rest of the file path is contructed using /lib/.
This commit is contained in:
Abhishek Verma 2025-02-04 17:30:23 +01:00 committed by Jörg Hofrichter
parent 5b7c668bd5
commit b2f7a87b0f

View file

@ -524,7 +524,14 @@ std::string uhd::find_image_path(
std::string uhd::find_utility(const std::string& name)
{
#ifdef UHD_PLATFORM_WIN32
/* python scripts are present under /lib/uhd/utils but the function
get_lib_path() return path including /bin/. This is because dll is located under /bin/
Correcting this behavior by using get_pkg_path() and appending /lib/. */
return (fs::path(uhd::get_pkg_path()) / "lib" / "uhd" / "utils" / name).string();
#else
return fs::path(fs::path(uhd::get_lib_path()) / "uhd" / "utils" / name).string();
#endif
}
std::string uhd::print_utility_error(const std::string& name, const std::string& args)