3 #include <SimoxUtility/algorithm/string.h>
4 #include <SimoxUtility/filesystem/list_directory.h>
11 #include <VisionX/libraries/armem_human/aron/Profile.aron.generated.h>
15 namespace fs = std::filesystem;
18 packageName(packageName), relativeDirectory(relativeDirectory)
27 absPackageDataDir.clear();
39 if (absPackageDataDir.empty())
42 if (not packageFinder.packageFound())
44 ARMARX_INFO <<
"Could not find package '" << packageName <<
"'. "
45 <<
"Not loading human profiles.";
47 absPackageDataDir = packageFinder.getDataDir();
50 ARMARX_INFO <<
"No data directory " << relativeDirectory
51 <<
" in the package '" << packageName <<
"'. "
52 <<
"Not loading human profiles.";
65 Finder::isDatasetDirValid(
const path& path)
const
67 return std::filesystem::is_directory(
path);
70 std::optional<armarx::armem::human::Info>
78 path profileDir = absPackageDataDir / relativeDirectory / name;
79 if (not fs::is_directory(profileDir))
86 std::vector<armarx::armem::human::Info>
95 std::vector<armarx::armem::human::Info> infos;
96 ARMARX_INFO <<
"Scanning " << _rootDirAbs() <<
" for human profiles ...";
98 const bool local =
false;
99 for (
const path& profileDir : simox::fs::list_directory(_rootDirAbs(), local))
101 if (fs::is_directory(profileDir))
104 packageName, absPackageDataDir, relativeDirectory, profileDir.filename());
108 ARMARX_INFO <<
"Found " << infos.size() <<
" human profiles.";
114 Finder::_rootDirAbs()
const
116 return absPackageDataDir / packageName / relativeDirectory;
120 Finder::_rootDirRel()
const
126 Finder::_ready()
const
128 return !absPackageDataDir.empty() &&
129 std::filesystem::exists(absPackageDataDir / packageName / relativeDirectory);