aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2017-01-18 11:02:08 -0800
committerMartin Braun <martin.braun@ettus.com>2017-01-18 11:02:08 -0800
commit4661358a0bc90f215ee0e18d2515d5cb974561c8 (patch)
treeda72ca2fbb5e06fa2860dad42acd8d66e45065d3 /host/lib
parent52ca2e0b8045c254c2be1911e77e8bd3d94ceeab (diff)
parentd778c0af9daf350de29c3acb7ab1cc59f63dd641 (diff)
downloaduhd-4661358a0bc90f215ee0e18d2515d5cb974561c8.tar.gz
uhd-4661358a0bc90f215ee0e18d2515d5cb974561c8.tar.bz2
uhd-4661358a0bc90f215ee0e18d2515d5cb974561c8.zip
Merge branch 'maint'
Diffstat (limited to 'host/lib')
-rw-r--r--host/lib/rfnoc/blockdef_xml_impl.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/host/lib/rfnoc/blockdef_xml_impl.cpp b/host/lib/rfnoc/blockdef_xml_impl.cpp
index 3de3a0ba0..78d1995d1 100644
--- a/host/lib/rfnoc/blockdef_xml_impl.cpp
+++ b/host/lib/rfnoc/blockdef_xml_impl.cpp
@@ -416,15 +416,30 @@ private:
blockdef::sptr blockdef::make_from_noc_id(uint64_t noc_id)
{
std::vector<fs::path> paths = blockdef_xml_impl::get_xml_paths();
- // Iterate over all paths
+ std::vector<fs::path> valid;
+
+ // Check if any of the paths exist
BOOST_FOREACH(const fs::path &base_path, paths) {
fs::path this_path = base_path / XML_BLOCKS_SUBDIR;
- if (not fs::exists(this_path) or not fs::is_directory(this_path)) {
- continue;
+ if (fs::exists(this_path) and fs::is_directory(this_path)) {
+ valid.push_back(this_path);
}
+ }
+
+ if (valid.empty())
+ {
+ throw uhd::assertion_error(
+ "Failed to find a valid XML path for RFNoC blocks.\n"
+ "Try setting the enviroment variable UHD_RFNOC_DIR "
+ "to the correct location"
+ );
+ }
+
+ // Iterate over all paths
+ BOOST_FOREACH(const fs::path &path, valid) {
// Iterate over all .xml files
fs::directory_iterator end_itr;
- for (fs::directory_iterator i(this_path); i != end_itr; ++i) {
+ for (fs::directory_iterator i(path); i != end_itr; ++i) {
if (not fs::exists(*i) or fs::is_directory(*i) or fs::is_empty(*i)) {
continue;
}