From a48dbb654e23a06b8d0ee42ed467f4f2612ded3d Mon Sep 17 00:00:00 2001 From: Michael Dickens Date: Mon, 28 Oct 2013 20:58:46 -0400 Subject: utils: fix declaration of "env_path_sep" such that it is always initialized before it is used in the "get_env_paths" function, by moving it from the global scope to inside that function. This change allows UHD_STATIC_BLOCK(load_modules) to work correctly. --- host/lib/utils/paths.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'host/lib/utils/paths.cpp') diff --git a/host/lib/utils/paths.cpp b/host/lib/utils/paths.cpp index 53055314b..d2686ac64 100644 --- a/host/lib/utils/paths.cpp +++ b/host/lib/utils/paths.cpp @@ -33,9 +33,20 @@ namespace fs = boost::filesystem; +/*********************************************************************** + * Get a list of paths for an environment variable + **********************************************************************/ +static std::string get_env_var(const std::string &var_name, const std::string &def_val = ""){ + const char *var_value_ptr = std::getenv(var_name.c_str()); + return (var_value_ptr == NULL)? def_val : var_value_ptr; +} + +static std::vector get_env_paths(const std::string &var_name){ + /*********************************************************************** * Determine the paths separator **********************************************************************/ + #ifdef UHD_PLATFORM_WIN32 static const std::string env_path_sep = ";"; #else @@ -46,16 +57,6 @@ namespace fs = boost::filesystem; boost::tokenizer > \ (inp, boost::char_separator(env_path_sep.c_str())) -/*********************************************************************** - * Get a list of paths for an environment variable - **********************************************************************/ -static std::string get_env_var(const std::string &var_name, const std::string &def_val = ""){ - const char *var_value_ptr = std::getenv(var_name.c_str()); - return (var_value_ptr == NULL)? def_val : var_value_ptr; -} - -static std::vector get_env_paths(const std::string &var_name){ - std::string var_value = get_env_var(var_name); //convert to filesystem path, filter blank paths -- cgit v1.2.3 From e6a1de6dd1f2350709cea21fdf2871c11eb60416 Mon Sep 17 00:00:00 2001 From: Nicholas Corgan Date: Wed, 30 Oct 2013 09:08:03 -0700 Subject: paths: get_module_paths adds share/uhd/modules to the list of applicable paths --- host/lib/utils/paths.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'host/lib/utils/paths.cpp') diff --git a/host/lib/utils/paths.cpp b/host/lib/utils/paths.cpp index d2686ac64..25cade693 100644 --- a/host/lib/utils/paths.cpp +++ b/host/lib/utils/paths.cpp @@ -86,6 +86,7 @@ std::vector get_image_paths(void){ std::vector get_module_paths(void){ std::vector paths = get_env_paths("UHD_MODULE_PATH"); paths.push_back(fs::path(uhd::get_pkg_path()) / UHD_LIB_DIR / "uhd" / "modules"); + paths.push_back(fs::path(uhd::get_pkg_path()) / "share" / "uhd" / "modules"); return paths; } -- cgit v1.2.3