[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 02/07: added user settings directory as a g
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 02/07: added user settings directory as a gr::-accessible path |
Date: |
Wed, 11 May 2016 17:41:07 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 438fb307a0b593706a212a3cd6e16f217a8704d0
Author: Marcus Müller <address@hidden>
Date: Sat May 7 17:14:49 2016 +0200
added user settings directory as a gr::-accessible path
* removing a bit of "magic paths" in prefs.cc
* added constant
---
gnuradio-runtime/include/gnuradio/sys_paths.h | 3 +++
gnuradio-runtime/lib/prefs.cc | 13 +++++--------
gnuradio-runtime/lib/sys_paths.cc | 9 +++++++++
3 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/gnuradio-runtime/include/gnuradio/sys_paths.h
b/gnuradio-runtime/include/gnuradio/sys_paths.h
index 1bd2e0d..efea07b 100644
--- a/gnuradio-runtime/include/gnuradio/sys_paths.h
+++ b/gnuradio-runtime/include/gnuradio/sys_paths.h
@@ -32,6 +32,9 @@ namespace gr {
//! directory to store application data
GR_RUNTIME_API const char *appdata_path();
+ //! directory to store user configuration
+ GR_RUNTIME_API const char *userconf_path();
+
} /* namespace gr */
#endif /* GR_SYS_PATHS_H */
diff --git a/gnuradio-runtime/lib/prefs.cc b/gnuradio-runtime/lib/prefs.cc
index b303ffd..7fd38ef 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 64853c6..3bf6697 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 */
- [Commit-gnuradio] [gnuradio] branch master updated (6c2851d -> 2aec2ff), git, 2016/05/11
- [Commit-gnuradio] [gnuradio] 06/07: Merge branch 'maint', git, 2016/05/11
- [Commit-gnuradio] [gnuradio] 04/07: grc: Added bits (unpacked bytes) as a data type, git, 2016/05/11
- [Commit-gnuradio] [gnuradio] 03/07: added options to query the full configuration as read by gr::prefs, git, 2016/05/11
- [Commit-gnuradio] [gnuradio] 05/07: Merge remote-tracking branch 'mmueller/gr-conf-info-add-config-queries', git, 2016/05/11
- [Commit-gnuradio] [gnuradio] 02/07: added user settings directory as a gr::-accessible path,
git <=
- [Commit-gnuradio] [gnuradio] 07/07: Merge remote-tracking branch 'nwest/uhd-add-tag-cmd', git, 2016/05/11
- [Commit-gnuradio] [gnuradio] 01/07: uhd: add command handler to add a time tag, git, 2016/05/11