summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/lib
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-runtime/lib')
-rw-r--r--gnuradio-runtime/lib/prefs.cc13
-rw-r--r--gnuradio-runtime/lib/sys_paths.cc9
2 files changed, 14 insertions, 8 deletions
diff --git a/gnuradio-runtime/lib/prefs.cc b/gnuradio-runtime/lib/prefs.cc
index b303ffdaf9..7fd38ef6d7 100644
--- a/gnuradio-runtime/lib/prefs.cc
+++ b/gnuradio-runtime/lib/prefs.cc
@@ -77,10 +77,9 @@ namespace gr {
// 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
// installed path config files.
- fs::path homedir = fs::path(gr::appdata_path());
- homedir = homedir/".gnuradio/config.conf";
- if(fs::exists(homedir)) {
- fnames.push_back(homedir.string());
+ fs::path userconf = fs::path(gr::userconf_path()) / "config.conf";
+ if(fs::exists(userconf)) {
+ fnames.push_back(userconf.string());
}
return fnames;
@@ -222,10 +221,8 @@ namespace gr {
prefs::save()
{
std::string conf = to_string();
-
- fs::path homedir = fs::path(gr::appdata_path());
- homedir = homedir/".gnuradio/config.conf";
- fs::ofstream fout(homedir);
+ fs::path userconf = fs::path(gr::userconf_path()) / "config.conf";
+ fs::ofstream fout(userconf);
fout << conf;
fout.close();
}
diff --git a/gnuradio-runtime/lib/sys_paths.cc b/gnuradio-runtime/lib/sys_paths.cc
index 64853c68b2..3bf6697bac 100644
--- a/gnuradio-runtime/lib/sys_paths.cc
+++ b/gnuradio-runtime/lib/sys_paths.cc
@@ -23,6 +23,8 @@
#include <cstdlib> //getenv
#include <cstdio> //P_tmpdir (maybe)
+#include <boost/filesystem/path.hpp>
+
namespace gr {
const char *tmp_path()
@@ -62,4 +64,11 @@ namespace gr {
return tmp_path();
}
+ const char *userconf_path()
+ {
+ boost::filesystem::path p(appdata_path());
+ p = p / ".gnuradio";
+ return p.c_str();
+ }
+
} /* namespace gr */