SenseApiMgr: Permit multiple lib search paths
This commit is contained in:
@@ -24,7 +24,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
std::string argv0;
|
std::string argv0;
|
||||||
std::string senseApiLibPath;
|
std::vector<std::string> senseApiLibPath;
|
||||||
std::vector<std::string> senseApiLibs;
|
std::vector<std::string> senseApiLibs;
|
||||||
std::string deviceSpecs;
|
std::string deviceSpecs;
|
||||||
std::vector<std::string> deviceSpecFiles;
|
std::vector<std::string> deviceSpecFiles;
|
||||||
|
|||||||
+6
-9
@@ -52,13 +52,6 @@ void OptionParser::parseArguments(int argc, char *argv[], char **envp)
|
|||||||
{
|
{
|
||||||
struct stat info;
|
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))
|
if (stat(optarg, &info) != 0 || !(info.st_mode & S_IFDIR))
|
||||||
{
|
{
|
||||||
throw std::invalid_argument(
|
throw std::invalid_argument(
|
||||||
@@ -66,7 +59,7 @@ void OptionParser::parseArguments(int argc, char *argv[], char **envp)
|
|||||||
"directory: " + optarg);
|
"directory: " + optarg);
|
||||||
}
|
}
|
||||||
|
|
||||||
senseApiLibPath = optarg;
|
senseApiLibPath.push_back(optarg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'v':
|
case 'v':
|
||||||
@@ -109,7 +102,11 @@ std::string OptionParser::stringifyOptions(void) const
|
|||||||
}
|
}
|
||||||
oss << std::endl;
|
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: ";
|
oss << "Sense API Libraries: ";
|
||||||
for (const auto& lib : senseApiLibs) {
|
for (const auto& lib : senseApiLibs) {
|
||||||
oss << lib << " ";
|
oss << lib << " ";
|
||||||
|
|||||||
@@ -35,10 +35,14 @@ static std::optional<std::string> findLibraryPath(
|
|||||||
fs::path("/proc/self/exe").parent_path().string()
|
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.insert(
|
||||||
searchPaths.begin(), OptionParser::getOptions().senseApiLibPath);
|
searchPaths.begin(),
|
||||||
|
options.senseApiLibPath.begin(),
|
||||||
|
options.senseApiLibPath.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& path : searchPaths)
|
for (const auto& path : searchPaths)
|
||||||
|
|||||||
Reference in New Issue
Block a user