Skip to content

Commit

Permalink
host: utils: Fixed python script paths under utils for windows
Browse files Browse the repository at this point in the history
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/.
  • Loading branch information
Abhverma-NI authored and joergho committed Feb 7, 2025
1 parent 5b7c668 commit b2f7a87
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions host/lib/utils/paths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b2f7a87

Please sign in to comment.