diff options
author | Marcus Müller <mmueller@gnuradio.org> | 2019-05-11 11:35:33 +0200 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2019-06-18 21:52:55 -0700 |
commit | 6b643b99b5cbd50ff95a22017cc15c27432dcd8f (patch) | |
tree | b21de5dad52cab4f6961123e80acd9c62b1eae6b /gnuradio-runtime/lib/prefs.cc | |
parent | 499a9548edd47ed312ba224e2039426aadc1ed33 (diff) |
runtime: prefs: parse user config even if sys conf dir isn't a directory
Before, this lead to systems where due to missing system paths, a user
couldn't even use their own config file, because GNU Radio didn't even
look for it.
Diffstat (limited to 'gnuradio-runtime/lib/prefs.cc')
-rw-r--r-- | gnuradio-runtime/lib/prefs.cc | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/gnuradio-runtime/lib/prefs.cc b/gnuradio-runtime/lib/prefs.cc index 18acae0124..426fbd33c2 100644 --- a/gnuradio-runtime/lib/prefs.cc +++ b/gnuradio-runtime/lib/prefs.cc @@ -67,16 +67,15 @@ namespace gr { std::vector<std::string> fnames; fs::path dir = prefsdir(); - if(!fs::is_directory(dir)) - return fnames; - - fs::directory_iterator diritr(dir); - while(diritr != fs::directory_iterator()) { - fs::path p = *diritr++; - if(p.extension() == ".conf") - fnames.push_back(p.string()); + if(fs::is_directory(dir)) { + fs::directory_iterator diritr(dir); + while(diritr != fs::directory_iterator()) { + fs::path p = *diritr++; + if(p.extension() == ".conf") + fnames.push_back(p.string()); + } + std::sort(fnames.begin(), fnames.end()); } - std::sort(fnames.begin(), fnames.end()); // Find if there is a ~/.gnuradio/config.conf file and add this to // the end of the file list to override any preferences in the |