SenseApiMgr: Permit multiple lib search paths

This commit is contained in:
2025-07-23 00:12:50 -04:00
parent 020a4968e5
commit 064dc43fbc
3 changed files with 13 additions and 12 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ public:
public:
std::string argv0;
std::string senseApiLibPath;
std::vector<std::string> senseApiLibPath;
std::vector<std::string> senseApiLibs;
std::string deviceSpecs;
std::vector<std::string> deviceSpecFiles;
+6 -9
View File
@@ -52,13 +52,6 @@ void OptionParser::parseArguments(int argc, char *argv[], char **envp)
{
struct stat info;
if (!senseApiLibPath.empty())
{
std::cerr << std::string(__func__)
+ " - Overwriting previous sense-api-path with: " << optarg
<< '\n';
}
if (stat(optarg, &info) != 0 || !(info.st_mode & S_IFDIR))
{
throw std::invalid_argument(
@@ -66,7 +59,7 @@ void OptionParser::parseArguments(int argc, char *argv[], char **envp)
"directory: " + optarg);
}
senseApiLibPath = optarg;
senseApiLibPath.push_back(optarg);
break;
}
case 'v':
@@ -109,7 +102,11 @@ std::string OptionParser::stringifyOptions(void) const
}
oss << std::endl;
oss << "Sense API Library Path: " << senseApiLibPath << std::endl;
oss << "Sense API Library Paths: ";
for (const auto& path : senseApiLibPath) {
oss << path << " ";
}
oss << std::endl;
oss << "Sense API Libraries: ";
for (const auto& lib : senseApiLibs) {
oss << lib << " ";
+6 -2
View File
@@ -35,10 +35,14 @@ static std::optional<std::string> findLibraryPath(
fs::path("/proc/self/exe").parent_path().string()
};
if (!OptionParser::getOptions().senseApiLibPath.empty())
const auto& options = OptionParser::getOptions();
if (!options.senseApiLibPath.empty())
{
// Insert all sense API library paths at the beginning of search paths
searchPaths.insert(
searchPaths.begin(), OptionParser::getOptions().senseApiLibPath);
searchPaths.begin(),
options.senseApiLibPath.begin(),
options.senseApiLibPath.end());
}
for (const auto& path : searchPaths)