13 #include "knowrob/URI.h" 
   14 #include "knowrob/Logger.h" 
   25         : path_(std::move(path)),
 
   26           protocol_(std::move(protocol)),
 
   27           host_(std::move(host)),
 
   32 URI::URI(
const boost::property_tree::ptree &property_tree) {
 
   34     path_ = property_tree.get(
"path", 
"/");
 
   36     port_ = property_tree.get_optional<
int>(
"port");
 
   55     auto env_drive = getenv(
"HOMEDRIVE");
 
   56     auto env_path = getenv(
"HOMEPATH");
 
   57     if (env_drive && env_path) {
 
   60         KB_WARN(
"Could not determine home directory");
 
   64     auto env_home = getenv(
"HOME");
 
   68         struct passwd *pw = getpwuid(getuid());
 
   72             KB_WARN(
"Could not determine home directory");
 
   80     static std::filesystem::path projectPath(KNOWROB_SOURCE_DIR);
 
   81     static std::filesystem::path installPath(KNOWROB_INSTALL_PREFIX);
 
   82     static std::filesystem::path buildPath(KNOWROB_BUILD_DIR);
 
   83     static std::optional<std::string> homePath(
getHomePath());
 
   85     std::filesystem::path filePath(uriString);
 
   86     if (!exists(filePath)) {
 
   87         std::vector<std::filesystem::path> possiblePaths;
 
   89         possiblePaths.push_back(projectPath / filePath);
 
   90         possiblePaths.push_back(projectPath / 
"src" / filePath);
 
   93             possiblePaths.push_back(std::filesystem::path(homePath.value()) / 
".knowrob" / filePath);
 
   96         possiblePaths.push_back(installPath / 
"share" / 
"knowrob" / filePath);
 
   97         possiblePaths.push_back(installPath / 
"lib" / 
"knowrob" / filePath);
 
   99         possiblePaths.push_back(buildPath / filePath);
 
  101         for (
const auto &p: possiblePaths) {
 
  102             if (exists(p)) 
return p.u8string();
 
boost::optional< int > port_
static std::optional< std::string > getHomePath(void)
boost::optional< std::string > host_
boost::optional< std::string > protocol_
static std::string resolve(const std::string_view &uriString)
URI(std::string_view path)