Don't std::filesystem::path::/= an absolute path

Unlike std::experimental::filesystem::path, with
std::filesystem::path, the /= operator will turn an append
of an absolute path (starts with a '/') into a '='.

So, ensure the paths aren't absolute.

Change-Id: Ie8fb9d056042e277415e8ea0eb29d094a2665611
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/sysfs.cpp b/sysfs.cpp
index e554afe..09fc26b 100644
--- a/sysfs.cpp
+++ b/sysfs.cpp
@@ -162,10 +162,16 @@
     return emptyString;
 }
 
-std::string findHwmonFromOFPath(const std::string& ofNode)
+std::string findHwmonFromOFPath(std::string ofNode)
 {
     static constexpr auto hwmonRoot = "/sys/class/hwmon";
 
+    // Can't append an absolute path
+    if (!ofNode.empty() && (ofNode.front() == '/'))
+    {
+        ofNode = ofNode.substr(1);
+    }
+
     fs::path fullOfPath{ofRoot};
     fullOfPath /= ofNode;
 
@@ -203,8 +209,14 @@
     return emptyString;
 }
 
-std::string findHwmonFromDevPath(const std::string& devPath)
+std::string findHwmonFromDevPath(std::string devPath)
 {
+    // Can't append an absolute path
+    if (!devPath.empty() && devPath.front() == '/')
+    {
+        devPath = devPath.substr(1);
+    }
+
     fs::path p{"/sys"};
     p /= devPath;
     p /= "hwmon";
diff --git a/sysfs.hpp b/sysfs.hpp
index c1799f6..e93db65 100644
--- a/sysfs.hpp
+++ b/sysfs.hpp
@@ -50,7 +50,7 @@
  *  @returns[in] - The hwmon instance path or an empty
  *                 string if no match is found.
  */
-std::string findHwmonFromOFPath(const std::string& ofNode);
+std::string findHwmonFromOFPath(std::string ofNode);
 
 /** @brief Find hwmon instances from a device path
  *
@@ -63,7 +63,7 @@
  *  @return - The hwmon instance path or an empty
  *            string if no match is found.
  */
-std::string findHwmonFromDevPath(const std::string& devPath);
+std::string findHwmonFromDevPath(std::string devPath);
 
 /** @brief Return the path to use for a call out.
  *