diff options
author | Josh Blum <josh@joshknows.com> | 2011-11-16 10:36:59 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-11-16 10:36:59 -0800 |
commit | 65b6acc1ac877849eb6cbe1a654562ca22e42c07 (patch) | |
tree | beca09db5794eb5a797c1c94e6ed4ad523a17f84 /host/lib/utils/paths.cpp | |
parent | eb11b05298dde8df750e903fe7d791050666278d (diff) | |
parent | 95568c8b30490f630a72b665b135c46549ee5882 (diff) | |
download | uhd-65b6acc1ac877849eb6cbe1a654562ca22e42c07.tar.gz uhd-65b6acc1ac877849eb6cbe1a654562ca22e42c07.tar.bz2 uhd-65b6acc1ac877849eb6cbe1a654562ca22e42c07.zip |
Merge branch 'calibration'
Diffstat (limited to 'host/lib/utils/paths.cpp')
-rw-r--r-- | host/lib/utils/paths.cpp | 27 |
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(); +} |