30#include <boost/algorithm/string.hpp>
31#include <boost/filesystem.hpp>
41inline namespace Kernel {
74 string env_content = current_env[path_variable];
80 return (not boost::filesystem::exists(p));
82 found_list.
erase(new_end, found_list.
end());
95 boost::split(str_list, path_string, boost::is_any_of(
PATH_SEP));
106template Item getPathFromLocations(
const Item& file_name,
const vector<Item>& locations);
107template Item getPathFromLocations(
const Item& file_name,
const vector<string>& locations);
108template Item getPathFromLocations(
const string& file_name,
const vector<Item>& locations);
109template Item getPathFromLocations(
const string& file_name,
const vector<string>& locations);
116template Item getPathFromEnvVariable<Item>(
const Item& file_name,
const string& path_variable);
117template Item getPathFromEnvVariable<string>(
const string& file_name,
const string& path_variable);
Defines a class to handle the Environment.
provide functions to retrieve resources pointed by environment variables
This file is intended to iron out all the differences between systems (currently Linux and MacOSX)
Python dictionary-like Environment interface.
ELEMENTS_API const std::map< Type, const std::vector< std::string > > SUFFIXES
map containing the default project installation suffixes for each variable
ELEMENTS_API const std::map< Type, const std::vector< std::string > > DEFAULT_LOCATIONS
map containing the default external locations for each variable
ELEMENTS_API std::vector< Item > getLocationsFromEnv(const std::string &path_variable, bool exist_only=false)
function to get the locations from an environment variable
ELEMENTS_API std::vector< Item > removeDuplicates(const std::vector< T > &path_list)
remove duplicated paths keeping the order
ELEMENTS_API std::string joinPath(const std::vector< T > &path_list)
collate a vector of path into a string using PATH_SEP
ELEMENTS_API auto split(Args &&... args) -> decltype(splitPath(std::forward< Args >(args)...))
alias for the splitPath function
ELEMENTS_API const std::map< Type, const std::string > VARIABLE
map containing the name of the path variable for each type
ELEMENTS_API std::vector< Item > splitPath(const std::string &path_string)
split a string into a vector of path using PATH_SEP
ELEMENTS_API const std::map< Type, const bool > HAS_SUBLEVELS
map containing the sub-level property of the path components
ELEMENTS_API std::vector< Item > getLocations(const Type &path_type, bool exist_only=false)
function to get the locations for the specific type
ELEMENTS_API const std::string PATH_SEP
Separator of path entries. Usually ":" on Unix.
ELEMENTS_API std::vector< Item > multiPathAppend(const std::vector< T > &initial_locations, const std::vector< U > &suffixes)
path join each suffix to each initial locations
boost::filesystem::path Item
const std::string SHLIB_VAR_NAME
name of the shared dynamic library path