Fix issue with dashes in fru names
Replace dashes and spaces with underscores.
Change-Id: I94f66f576e1443de46e6c2eb5ca73f52bd79169b
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/src/FruDevice.cpp b/src/FruDevice.cpp
index 1c01f95..7272327 100644
--- a/src/FruDevice.cpp
+++ b/src/FruDevice.cpp
@@ -27,6 +27,7 @@
#include <linux/i2c-dev-user.h>
#include <iostream>
#include <sys/ioctl.h>
+#include <regex>
namespace fs = std::experimental::filesystem;
static constexpr bool DEBUG = false;
@@ -351,6 +352,8 @@
if (productNameFind != formattedFru.end())
{
productName = productNameFind->second;
+ std::regex illegalObject("[^A-Za-z0-9_]");
+ productName = std::regex_replace(productName, illegalObject, "_");
}
else
{