diff options
author | Paul David <pudavid@fastmail.com> | 2017-01-12 21:36:40 -0500 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-01-17 11:19:12 -0800 |
commit | 27f2d44eb0cf2a0cb103bd2f8821d66c77c3a851 (patch) | |
tree | 836aca91518d5bcb1bc13af1a67537e686452cd1 | |
parent | 95ff7e859d57829e428d41d7746e28c228b983ba (diff) | |
download | uhd-27f2d44eb0cf2a0cb103bd2f8821d66c77c3a851.tar.gz uhd-27f2d44eb0cf2a0cb103bd2f8821d66c77c3a851.tar.bz2 uhd-27f2d44eb0cf2a0cb103bd2f8821d66c77c3a851.zip |
RFNoC: Produce an accurate error for missing XML directory
-rw-r--r-- | host/lib/rfnoc/blockdef_xml_impl.cpp | 23 |
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; } |