summaryrefslogtreecommitdiffstats
path: root/host/lib/utils/paths.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-11-10 20:22:54 -0800
committerJosh Blum <josh@joshknows.com>2011-11-10 20:22:54 -0800
commit8459432067055759bd1d9b04f0e7943f1cf35d2d (patch)
treeb647f54fa9ccbbcd289acc21a8806e940b7a9c4b /host/lib/utils/paths.cpp
parent3cb60c974fff6779396294fd456904d1f6addd71 (diff)
downloaduhd-8459432067055759bd1d9b04f0e7943f1cf35d2d.tar.gz
uhd-8459432067055759bd1d9b04f0e7943f1cf35d2d.tar.bz2
uhd-8459432067055759bd1d9b04f0e7943f1cf35d2d.zip
usrp: basically working iq cal on tx
Diffstat (limited to 'host/lib/utils/paths.cpp')
-rw-r--r--host/lib/utils/paths.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/host/lib/utils/paths.cpp b/host/lib/utils/paths.cpp
index a3dd377e5..4fc877d5d 100644
--- a/host/lib/utils/paths.cpp
+++ b/host/lib/utils/paths.cpp
@@ -16,6 +16,7 @@
//
#include <uhd/config.hpp>
+#include <uhd/utils/paths.hpp>
#include <boost/tokenizer.hpp>
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
@@ -23,6 +24,8 @@
#include <cstdlib>
#include <string>
#include <vector>
+#include <cstdlib> //getenv
+#include <cstdio> //P_tmpdir
namespace fs = boost::filesystem;
@@ -79,3 +82,27 @@ std::vector<fs::path> get_module_paths(void){
paths.push_back(get_uhd_pkg_data_path() / "modules");
return paths;
}
+
+/***********************************************************************
+ * Implement the functions in paths.hpp
+ **********************************************************************/
+std::string uhd::get_tmp_path(void){
+ const char *tmp_path = std::getenv("TMP");
+ if (tmp_path != NULL) return tmp_path;
+
+ #ifdef P_tmpdir
+ if (P_tmpdir != NULL) return P_tmpdir;
+ #endif
+
+ return "/tmp";
+}
+
+std::string uhd::get_app_path(void){
+ const char *appdata_path = std::getenv("APPDATA");
+ if (appdata_path != NULL) return appdata_path;
+
+ const char *home_path = std::getenv("HOME");
+ if (home_path != NULL) return home_path;
+
+ return uhd::get_tmp_path();
+}